-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.production.config.js
40 lines (34 loc) · 1.06 KB
/
webpack.production.config.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
var _ = require('lodash');
var webpack = require('webpack');
var path = require('path');
var commonConfigOrigin = require('./webpack.common.config');
var commonConfig = _.cloneDeep(commonConfigOrigin);
delete commonConfig['devtool'];
commonConfig.output.filename = '[name].[chunkhash].js';
commonConfig.plugins = [
// Webpack 1.0
require('./assetsPlugin'),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.AggressiveMergingPlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
// Webpack 2.0 fixed this mispelling
// new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.DllReferencePlugin({
context: '.',
manifest: require('./manifest/vendor-manifest.json'),
sourceType: 'var'
}),
new webpack.DefinePlugin({
'__DEV__': false,
'__STAGING__': false,
'process.env.NODE_ENV': JSON.stringify('production')
}),
new webpack.optimize.UglifyJsPlugin({
mangle: {
except: ['$', 'exports', 'require']
},
compress: { warnings: false },
output: { comments: false }
})
];
module.exports = commonConfig;