-
Notifications
You must be signed in to change notification settings - Fork 17
/
vue.config.js
66 lines (61 loc) · 1.6 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
var path = require('path')
module.exports = {
filenameHashing: false,
pages: {
app: {
entry: 'src/app/main.ts',
chunks: ['chunk-common', 'chunk-app-vendors', 'app']
},
settings: {
entry: 'src/settings/main.ts',
chunks: ['chunk-common', 'chunk-settings-vendors', 'settings']
}
},
configureWebpack: (config) => {
config.devtool = 'source-map'
},
chainWebpack: config => {
Object.keys(module.exports.pages).forEach(page => config.plugins
.delete(`html-${page}`)
.delete(`preload-${page}`)
.delete(`prefetch-${page}`))
config.resolve.alias.set('@a', path.resolve(__dirname, 'src/app'))
config.resolve.alias.set('@s', path.resolve(__dirname, 'src/settings'))
// https://github.com/vuejs/vue-cli/issues/2381#issuecomment-425038367
const IS_VENDOR = /[\\/]node_modules[\\/]/
config.optimization.splitChunks({
cacheGroups: {
app: {
name: 'chunk-app-vendors',
priority: -11,
chunks: chunk => chunk.name === 'app',
test: IS_VENDOR,
enforce: true
},
settings: {
name: 'chunk-settings-vendors',
priority: -11,
chunks: chunk => chunk.name === 'settings',
test: IS_VENDOR,
enforce: true
},
common: {
name: 'chunk-common',
priority: -20,
chunks: 'initial',
minChunks: 2,
reuseExistingChunk: true,
enforce: true
}
}
})
},
css: {
extract: true,
loaderOptions: {
css: {
url: false
}
}
}
}