-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.config.js
60 lines (55 loc) · 1.61 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
// ESLint ignore first line
/* eslint-disable */
const path = require('path')
module.exports = {
publicPath: process.env.NODE_ENV === 'production'
? '/meowney-0-website/'
: '/',
lintOnSave: false,
chainWebpack: config => {
const dir = path.resolve(__dirname, 'src/assets/icons') // 确定目录
config.module.rule('svg').uses.clear()
config.module
.rule('svg-sprite')
.test(/\.svg$/) // .test(/\.(svg)(\?.*)?$/)
.include.add(dir).end() // 指定 仅包含 icons 的目录
.use('svg-sprite-loader').loader('svg-sprite-loader')
.options({extract: false}).end() // 不解析出文件
.use('svgo-loader').loader('svgo-loader')
.tap(options => ({
...options,
plugins: [{removeAttrs: {attrs: 'fill'}}]
}))
.end()
config.plugin('svg-sprite')
.use(
require('svg-sprite-loader/plugin'),
[{plainSprite: true}]
)
config.module.rule('svg').exclude.add(dir)// 其他 svg loader 排除 icons 目录
// alias
config.resolve.alias
.set('@', path.join(__dirname, 'src'))
.set('@style', path.join(__dirname, 'src/assets/style'))
.set('@comp', path.join(__dirname, 'src/components'))
.set('@mixins', path.join(__dirname, 'src/mixins'))
.set('@store', path.join(__dirname, 'src/store'))
// server
/*
config.devServer
.set('port', 8080)
'/api': {
target: 'http://localhost:8080',
changeOrigin: true,
pathRewrite: {
'^/api': '/mock'
}
}
})
*/
},
transpileDependencies: [
'vue-echarts',
'resize-detector'
]
}