-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.prod.js
76 lines (75 loc) · 1.81 KB
/
webpack.config.prod.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
65
66
67
68
69
70
71
72
73
74
75
76
var path = require('path');
var webpack = require('webpack');
module.exports = {
devtool: 'cheap-module-source-map',
entry: {
app: './src/index',
vendor: ['react', 'redux', 'react-redux', 'react-router', 'axios'],
},
output: {
path: __dirname + '/static/',
filename: 'bundle.js',
publicPath: '/static/'
},
resolve: {
extensions: ['', '.js', '.jsx']
},
module: {
loaders: [
{
test: /\.js$/,
loaders: ['babel']
}
],
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production')
}
}),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.CommonsChunkPlugin(/* chunkName= */"vendor", /* filename= */"vendor.bundle.js"),
new webpack.optimize.OccurenceOrderPlugin(),
/* Based on: https://github.com/webpack/webpack/issues/1205#issuecomment-154840823 */
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false,
properties: true,
sequences: true,
dead_code: true,
conditionals: true,
comparisons: true,
evaluate: true,
booleans: true,
unused: true,
loops: true,
hoist_funs: true,
cascade: true,
if_return: true,
join_vars: true,
drop_debugger: true,
unsafe: true,
hoist_vars: true,
negate_iife: true
},
mangle: {
toplevel: true,
sort: true,
eval: true,
properties: true
},
output: {
space_colon: false,
comments: function(node, comment) {
var text = comment.value;
var type = comment.type;
if (type == "comment2") {
// multiline comment
return /@copyright/i.test(text);
}
}
}
})
]
};