-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathvue.config.js
85 lines (85 loc) · 2.18 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
const path = require('path')
const mode = process.env.NODE_ENV
module.exports = {
publicPath: '/andt-components',
configureWebpack: config => {
config.externals = {
'vue': 'Vue',
'vue-router': 'VueRouter',
'vuex': 'Vuex',
'axios': 'axios',
'moment': 'moment'
}
config.resolve = {
extensions: ['.js', '.vue', '.json'],
alias: {
'@': path.resolve(__dirname, './src'),
assets: path.resolve(__dirname, './src/assets')
}
}
config.optimization = {
splitChunks: {
cacheGroups: {
vendors: {
name: 'vendors',
test: /[\\/]node_modules[\\/]/,
chunks: 'initial',
maxSize: 600000,
maxInitialRequests: 20,
priority: 2,
reuseExistingChunk: true,
enforce: true
},
common: {
name: 'common',
chunks: 'initial',
maxInitialRequests: 5,
minChunks: 2,
reuseExistingChunk: true,
priority: 1,
enforce: true
},
antdesign: {
name: 'ant-design-vue',
test: /[\\/]node_modules[\\/]ant-design-vue[\\/]/,
chunks: 'initial',
maxSize: 600000,
reuseExistingChunk: true,
priority: 3,
enforce: true
},
iview: {
name: 'view-ui',
test: /[\\/]node_modules[\\/]iview[\\/]/,
chunks: 'initial',
maxSize: 600000,
reuseExistingChunk: true,
priority: 3,
enforce: true
}
}
}
}
},
chainWebpack: config => {
config.module
.rule('eslint')
.use('eslint-loader')
.loader('eslint-loader')
.tap(options => {
options.fix = true
return options
})
},
css: {
loaderOptions: {
less: {
modifyvars: {
'font-family': 'PingFangSC-Regular, PingFang SC, tahoma, arial, "Hiragino Sans GB", "Microsoft yahei", "Segoe UI", roboto, "Helvetica Neue", sans-serif'
},
javascriptEnabled: true
}
}
},
parallel: require('os').cpus().length > 1
}