-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.config.js
39 lines (38 loc) · 1.28 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
const CompressionPlugin = require('compression-webpack-plugin')
module.exports = {
devServer: {
proxy: {
//#代理设置
// location /api{
// proxy_pass http://110.42.141.74:7866;
// }
'/api': {
target: 'http://110.42.141.74:7866',
//target: 'http://localhost:7866',
ws: true,
changeOrigin: true,
pathRewrite: {
'^/api': '/' //api替代target中的地址
}
},
}
},
configureWebpack: (config) => {
if (process.env.NODE_ENV === 'production') {
// 为生产环境修改配置...
config.mode = 'production'
return {
plugins: [
new CompressionPlugin({
algorithm: 'gzip', // 使用gzip压缩
test: /\.js$|\.html$|\.css/, //匹配文件名
threshold: 10240, //对超过10k的数据进行压缩
minRatio: 1, // 压缩率小于1才会压缩
deleteOriginalAssets: false //是否删除原文件
})
]
}
}
},
lintOnSave: false
}