-
Notifications
You must be signed in to change notification settings - Fork 0
/
vue.config.js
45 lines (39 loc) · 1.1 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
const path = require('path')
const workboxPlugin = require('workbox-webpack-plugin')
const isProd = process.env.NODE_ENV === 'production'
function resolve (dir) {
return path.join(__dirname, dir)
}
const workboxOptions = {
swSrc: resolve('src/sw/serviceWorker.js'),
swDest: 'serviceWorker.js',
importWorkboxFrom: 'disabled',
exclude: [/^workbox/, /\.map/]
}
module.exports = {
configureWebpack: (config) => {
config.plugins.push(
new workboxPlugin.InjectManifest(workboxOptions)
)
},
chainWebpack: (config) => {
if (process.env.NODE_ENV !== 'production') {
config.output
.set('filename', 'static/js/[name].[hash].js')
.set('chunkFilename', 'static/js/[name].[hash].js')
}
config.resolve.alias
.set('vue$', 'vue/dist/vue.esm.js')
.set('@', resolve('src'))
.set('styles', resolve('src/assets/styles'))
.set('utils', resolve('src/utils'))
config
.plugin('copy')
.tap(args => {
if (args.length !== 0) {
args[0][0].ignore = isProd ? ['*.dev.*'] : ['*.prod.*']
}
return args
})
}
}