fix(pwa): set cacheid in GenerateSW mode only (#939)

close #891
This commit is contained in:
Muzafar Umarov
2018-03-03 21:19:34 -05:00
committed by Evan You
parent a2ac6be36b
commit 43971d89ee

View File

@@ -24,15 +24,20 @@ module.exports = (api, options) => {
)
}
const workBoxConfig = Object.assign({
cacheId: name,
const defaultOptions = {
exclude: [
/\.map$/,
/img\/icons\//,
/favicon\.ico$/,
/manifest\.json$/
]
}, userOptions.workboxOptions)
}
const defaultGenerateSWOptions = workboxPluginMode === 'GenerateSW' ? {
cacheId: name
} : {}
const workBoxConfig = Object.assign(defaultOptions, defaultGenerateSWOptions, userOptions.workboxOptions)
webpackConfig
.plugin('workbox')