vue.config.js
1.64 KB
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
/* eslint-disable indent */
const FilemanagerWebpackPlugin = require('filemanager-webpack-plugin')
const path = require('path')
// 匹配路径方法
const resolve = dir => path.join(__dirname, dir)
const BASE_URL = process.env.NODE_ENV === 'production' ? '' : '/'
const plugins =
process.env.NODE_ENV === 'production'
? [
new FilemanagerWebpackPlugin({
onEnd: [
{ delete: [resolve('dist.zip')] },
{
archive: [
{ source: resolve('dist'), destination: resolve('dist.zip') }
]
}
]
})
]
: []
module.exports = {
lintOnSave: undefined,
assetsDir: 'static',
// 打包时不生成map文件,减少打包体积,加快打包速度
productionSourceMap: false,
devServer: {
https: true,
inline: true,
proxy: {
'/chery': {
target: process.env.VUE_APP_BASE_API
}
// '/': {
// bypass: devServerProxyBypass,
// secure: false,
// target: serverTarget,
// headers: {
// Host: new URL(serverTarget).host
// }
// }
}
},
configureWebpack: {},
chainWebpack: config => {
config.resolve.alias
.set('@', resolve('src'))
.set('_c', resolve('src/components'))
// 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()
}
}