-
Notifications
You must be signed in to change notification settings - Fork 0
/
vue.config.js
67 lines (59 loc) · 1.34 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
const path = require('path')
const name = '{{name}}'
const url = process.env.PROXY_URL
const base = process.env.VUE_APP_BASE_API
const port = process.env.PORT || 3333 // 端口
// https://cli.vuejs.org/zh/config/#vue-config-js
module.exports = {
publicPath: base,
outputDir: 'dist',
assetsDir: 'static',
lintOnSave: process.env.NODE_ENV === 'development',
productionSourceMap: false,
devServer: {
host: 'localhost',
port: port,
open: false,
proxy: {
[base]: {
target: url,
changeOrigin: true,
pathRewrite: {
['^' + base]: '',
},
},
},
disableHostCheck: true,
},
configureWebpack: {
name,
resolve: {
alias: {
'@': resolve('src'),
},
},
},
chainWebpack(config) {
config.when(process.env.NODE_ENV !== 'development', (config) => {
config.optimization.splitChunks({
chunks: 'all',
cacheGroups: {
libs: {
name: 'chunk-libs',
test: /[\\/]node_modules[\\/]/,
priority: 10,
chunks: 'initial',
},
elementUI: {
name: 'chunk-elementUI',
priority: 20,
test: /[\\/]node_modules[\\/]_?element-ui(.*)/,
},
},
})
})
},
}
function resolve(dir) {
return path.join(__dirname, dir)
}