-
Notifications
You must be signed in to change notification settings - Fork 16
/
vue.config.js
executable file
·35 lines (34 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
// vue.config.js
const path = require('path')
const CompressionWebpackPlugin = require('compression-webpack-plugin')
// 定义压缩文件类型
const productionGzipExtensions = ['js', 'css']
const isProduction = process.env.NODE_ENV === 'production'
module.exports = {
publicPath: process.env.NODE_ENV === 'production' ? '/pretty-vendor/' : '/',
lintOnSave: false,
productionSourceMap: false,
devServer: {
open: true, // 配置自动启动浏览器
proxy: {
'/api': {
target: 'http://118.31.77.247',
changeOrigin: true,
pathRewrite: {
'^/api': ''
}
}
}
},
configureWebpack: config => {
if (isProduction) {
config.plugins.push(new CompressionWebpackPlugin({
algorithm: 'gzip',
test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
threshold: 10240,
minRatio: 0.8
})
)
}
}
};