-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
vue.config.js
52 lines (49 loc) · 1.04 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
44
45
46
47
48
49
50
51
52
const CompressionWebpackPlugin = require('compression-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const compress = new CompressionWebpackPlugin({
filename: info => {
return `${info.path}.gz${info.query}`
},
algorithm: 'gzip',
threshold: 10240,
test: new RegExp(
'\\.(' + ['js'].join('|') +
')$'
),
minRatio: 0.8,
deleteOriginalAssets: false
})
module.exports = {
productionSourceMap: false,
devServer: {
before(app) {
app.get(/.*.(js)$/, (req, res, next) => {
req.url = req.url + '.gz';
res.set('Content-Encoding', 'gzip');
next();
})
}
},
configureWebpack: {
optimization: {
minimize: true,
minimizer: [new TerserPlugin({
terserOptions: {
compress: {
drop_console: true
}
}
})]
},
plugins: [compress]
},
chainWebpack: config => {
config.optimization.minimize(true);
config.optimization.splitChunks({
chunks: 'all'
})
},
css: {
extract: true
}
}