-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvue.config.js
68 lines (65 loc) · 1.74 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
58
59
60
61
62
63
64
65
66
67
68
const path = require('path');
module.exports = {
devServer: {
port: 2219,
// proxy: {
// '/hermes/api/v1/': {
// // target: 'http://koubeiapi.dev.1datatech.cn',
// target: 'http://192.168.1.209:8084',
// changeOrigin: true
// },
// '/bms/api/v1/': {
// // target: 'http://koubeiapi.dev.1datatech.cn',
// target: 'http://192.168.1.209:8084',
// changeOrigin: true
// }
// }
},
chainWebpack: config => {
/** 配置Eslint在代码保存时自动fix */
config.module
.rule('eslint')
.use('eslint-loader')
.loader('eslint-loader')
.tap(options => {
// 让eslint在save时自动fix code
options.fix = true
return options
}).end()
const iconsPath = path.resolve(__dirname, './src/icons');
config.module
.rule('svgIcon')
.test(/\.(svg)(\?.*)?$/)
.include
.add(iconsPath)
.end()
.use('svg-sprite-loader')
.loader('svg-sprite-loader')
.tap((options) => {
options = {
symbolId: 'vtaicon__[name]',
};
return options;
})
.end()
.use('svgo-loader')
.loader('svgo-loader')
.tap(() => {
return {
plugins: [
{ removeXMLNS: true }, // 删除xmlns属性(对于内联svg,默认情况下禁用)
{ convertStyleToAttrs: true }, // 将css样式转换为svg元素属性
{ removeUselessStrokeAndFill: true } // 移除不必要的fill和stroke属性
],
};
});
config.module
.rule('svg')
.exclude
.add(iconsPath)
.end();
},
transpileDependencies: [
'vuex-module-decorators'
]
}