-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathvue.config.js
43 lines (40 loc) · 1.12 KB
/
vue.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
var LodashModuleReplacementPlugin = require('lodash-webpack-plugin');
var UglifyJsPlugin = require('uglifyjs-webpack-plugin')
module.exports = {
// If extractCSS is always true, the 'Hot module replacement' will not work.
// extractCSS: process.env.NODE_ENV === 'production'
configureWebpack: config => {
// config.plugins = [new LodashModuleReplacementPlugin];
if (process.env.NODE_ENV === 'production')
{
// mutate config for production...
// console.log(config);
config.plugins.push(
new UglifyJsPlugin({
uglifyOptions:{
output: {
comments: false, // remove comments
},
compress: {
unused: true,
dead_code: true, // big one--strip code that will never execute
warnings: false, // good for prod apps so users can't peek behind curtain
drop_debugger: true,
conditionals: true,
// evaluate: true,
// drop_console: true, // strips console statements
sequences: true,
booleans: true,
},
mangle: true
},
}),
);
}
else
{
// mutate for development...
config.devtool = 'source-map'
}
}
};