-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathvue.config.js
64 lines (63 loc) · 1.52 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
const path = require('path')
const resolve = dir => path.join(__dirname, dir)
const svgPath = resolve('./src/assets/svg')
const { title } = require('./package')
module.exports = {
configureWebpack: {
name: title,
resolve: {
alias: {
'assets': '@/assets',
'components': '@/components',
'config': '@/config',
'models': '@/models',
'layouts': '@/layouts',
'mixins': '@/mixins',
'plugins': '@/plugins',
'services': '@/services',
'utils': '@/utils',
'views': '@/views'
}
}
},
// 添加对svg的自定义解析
chainWebpack: (config) => {
config.module.rule('svg').exclude.add(svgPath)
config.module.rule('icon').test(/\.svg$/)
.include.add(svgPath).end() // 回退上下文
.use('svg-sprite-loader').loader('svg-sprite-loader')
.options({ symbolId: 'icon-[name]' }).end()
},
// 指定Runtime + Compile来编译组件
runtimeCompiler: true,
pluginOptions: {
'style-resources-loader': {
preProcessor: 'less',
patterns: [
path.resolve(__dirname, './src/assets/css/mixin.less')
]
}
},
devServer: {
// host: '0.0.0.0',
port: 8080,
hot: true,
overlay: {
warnings: false,
errors: false
},
disableHostCheck: true,
headers: {
'Access-Control-Allow-Origin': '*'
},
proxy: {
'/api': {
target: 'http://dev.app.m2.com/m2',
changeOrigin: true,
pathRewrite: {
'/api': ''
}
}
}
}
}