-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.release.config.js
77 lines (69 loc) · 1.99 KB
/
webpack.release.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
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
77
var os = require('os');
const config = require('./webpack.config');
const webpack = require('webpack');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
config.output.filename = '[name].bundle.min.js';
// Apply code splitting
// https://webpack.js.org/guides/code-splitting/
// https://gist.github.com/sokra/1522d586b8e5c0f5072d7565c2bee693
config.optimization.splitChunks = {
cacheGroups: {
commons: {
//test: /[\\/]node_modules[\\/]/,
name: "commons",
filename: "commons.bundle.min.js",
chunks: "initial",
minChunks: 3,
reuseExistingChunk: true,
}
}
};
config.optimization.minimizer = [
// https://webpack.js.org/plugins/uglifyjs-webpack-plugin/
/*
new UglifyJsPlugin({
sourceMap: true,
cache: true,
parallel: true,
uglifyOptions: {
ie8: false,
compress: {
passes: 2,
//toplevel: true,
warnings: false,
properties: true,
sequences: true,
dead_code: true,
conditionals: true,
comparisons: true,
evaluate: true,
booleans: true,
unused: true,
loops: true,
hoist_funs: true,
hoist_props: true,
hoist_vars: true,
//cascade: true,
if_return: true,
join_vars: true,
drop_console: false,
drop_debugger: true,
//unsafe: true,
negate_iife: true,
//side_effects: true
},
mangle: {
//toplevel: true,
//sort: true,
//eval: true,
properties: true
},
output: {
comments: false,
beautify: false,
},
},
})
*/
];
module.exports = config;