-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.prod.js
45 lines (42 loc) · 1.1 KB
/
webpack.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
const webpack = require('webpack');
const merge = require('webpack-merge');
const common = require('./webpack.common.js');
const LicenseRegexp = /@preserve|@cc_on|\bMIT\b|\bMPL\b|\bGPL\b|\bBSD\b|\bISCL\b|\(c\)|License|Copyright/im;
module.exports = merge(common, {
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production'),
},
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
sequences: true,
properties: true,
dead_code: true,
drop_debugger: true,
conditionals: true,
comparisons: true,
evaluate: true,
loops: true,
unused: true,
toplevel: true,
hoist_funs: true,
if_return: true,
join_vars: true,
cascade: true,
collapse_vars: true,
reduce_vars: true,
warnings: false,
drop_console: true,
},
extractComments: {
condition: LicenseRegexp,
filename: file => `${file}.LICENSE.txt`,
},
comments: false,
sourceMap: true,
parallel: true,
}),
],
});