-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.prod.js
52 lines (48 loc) · 1.15 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
46
47
48
49
50
51
52
const merge = require('webpack-merge');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const common = require('./webpack.config.js');
const _UGLIFY_OPTIONS = {
compress: {
arrows: false,
booleans: false,
collapse_vars: false,
comparisons: false,
computed_props: false,
hoist_funs: false,
hoist_props: false,
hoist_vars: false,
if_return: false,
inline: false,
join_vars: false,
keep_infinity: true,
loops: false,
negate_iife: false,
properties: false,
reduce_funcs: false,
reduce_vars: false,
sequences: false,
side_effects: false,
switches: false,
top_retain: false,
toplevel: false,
typeofs: false,
unused: false,
// Switch off all types of compression except those needed to convince
// react-devtools that we're using a production build
conditionals: true,
dead_code: true,
evaluate: true,
},
mangle: true,
};
const _PRODUCTION_PLUGINS = [
new UglifyJsPlugin({
sourceMap: false,
uglifyOptions: _UGLIFY_OPTIONS
})
];
module.exports = merge(common, {
mode: 'production',
devtool: 'eval',
plugins: _PRODUCTION_PLUGINS
});