forked from trazyn/weweChat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.production.js
64 lines (53 loc) · 1.68 KB
/
webpack.config.production.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import path from 'path';
import webpack from 'webpack';
import MinifyPlugin from 'babel-minify-webpack-plugin';
import config from './index';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import CopyWebpackPlugin from 'copy-webpack-plugin';
import baseConfig from './webpack.config.base';
export default {
...baseConfig,
mode: 'production',
devtool: false,
entry: [
'babel-polyfill',
`${config.client}/app.js`,
],
output: {
path: config.dist,
filename: 'app.[hash].js'
},
plugins: [
// https://github.com/webpack/webpack/issues/2545
// Use babel-minify-webpack-plugin minify code
new MinifyPlugin(),
// https://webpack.github.io/docs/list-of-plugins.html#occurrenceorderplugin
// https://github.com/webpack/webpack/issues/864
new webpack.optimize.OccurrenceOrderPlugin(),
new CopyWebpackPlugin([
{
from: `${config.assets}/fonts/**/*`,
to: `${config.dist}/src`,
},
{
from: `${config.assets}/images/**/*`,
to: config.dist,
},
{
from: path.resolve(__dirname, '../package.json'),
to: config.dist,
},
]),
new HtmlWebpackPlugin({
filename: `${config.dist}/src/index.html`,
template: './src/index.html',
inject: 'body',
hash: true,
minify: {
collapseWhitespace: true
}
})
],
// https://github.com/chentsulin/webpack-target-electron-renderer#how-this-module-works
target: 'electron-renderer'
};