-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvue.config.js
51 lines (45 loc) · 1.17 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
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' ? '/' : '/',
pluginOptions: {
i18n: {
locale: 'en',
fallbackLocale: 'en',
localeDir: 'locales',
enableInSFC: false
}
},
configureWebpack: config => {
if (isProduction) {
config.plugins.push(new CompressionWebpackPlugin({
algorithm: 'gzip',
test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
threshold: 10240,
minRatio: 0.8
}));
}
config.externals = {
'vue': 'Vue',
'vue-router': 'VueRouter',
'element-ui': 'ELEMENT',
}
},
devServer: {
port: 8180,
host: '0.0.0.0',
https: false, // https:{type:Boolean}
open: true, //配置自动启动浏览器
proxy: {// 配置跨域处理
'/api': {
target: 'http://116.62.135.185:8081/',
changeOrigin: true, // 是否跨域
pathRewrite: {
'^/api': '/'
}
}
}
},
lintOnSave: false
};