-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.config.js
57 lines (54 loc) · 1.6 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
53
54
55
56
57
const path = require('path');
const vConsolePlugin = require('vconsole-webpack-plugin');
const isDevelopment = process.env.NODE_ENV === 'development';
const enableMobileConsole = JSON.parse(process.env.ENABLE_MOBILE_CONSOLE || false);
const resolve = (dir) => path.resolve(__dirname, dir);
/**
* If you want change default settings,
* place read vue-cli@3 configuration reference: https://cli.vuejs.org/config/
*/
module.exports = {
publicPath: process.env.VUE_APP_BASE_URL,
lintOnSave: isDevelopment ? false : false,
productionSourceMap: false,
outputDir: process.env.OUT_PUT_DIR,
chainWebpack: (config) => {
// set html default title
config.plugin('html').tap((args) => {
args[0].title = `${process.env.VUE_APP_BRAND}${process.env.VUE_APP_TITLE}`;
return args;
});
// set mobile vConsole
config.plugin('vConsole').use(vConsolePlugin, [{ enable: enableMobileConsole }]);
// set svg-sprite-loader
config.module
.rule('svg')
.exclude.add(resolve('src/icons'))
.end();
config.module
.rule('icons')
.test(/\.svg$/)
.include.add(resolve('src/icons'))
.end()
.use('svg-sprite-loader')
.loader('svg-sprite-loader')
.options({
symbolId: 'icon-[name]'
})
.end();
},
devServer: {
proxy: {
'/usercenter': {
target: process.env.PROXY_USER_CENTER_BASE_URL,
pathRewrite: { '^/usercenter': '' },
changeOrigin: true
},
'/api': {
target: process.env.PROXY_API_BASE_URL,
pathRewrite: { '^/api': '' },
changeOrigin: true
}
}
}
};