-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.config.js
45 lines (44 loc) · 1.08 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
const CompressionWebpackPlugin = require('compression-webpack-plugin');
const productionGzipExtensions = ['js', 'css'];
module.exports = {
lintOnSave: false,
productionSourceMap: false,
publicPath: './',
outputDir: process.env.VUE_APP_OUTPUTDIR,
assetsDir: '',
devServer: {
open: true,
port: 8199,
proxy: {
'/staging': {
target: 'http://192.168.12.133:3100',
changeOrigin: true,
pathRewrite: {
'^/staging': ''
}
}
}
},
configureWebpack: config => {
if (process.env.NODE_ENV === 'production') {
return {
plugins: [
new CompressionWebpackPlugin({
filename: '[path].gz[query]',
algorithm: 'gzip',
test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
threshold: 10240,
minRatio: 0.8
})
]
};
} else {
// 为开发环境修改配置...
}
},
chainWebpack: config => {
// 这里可以修改webpack配置
// 移除预加载
config.plugins.delete('prefetch');
}
};