Skip to content

Commit 43971d8

Browse files
umarovyyx990803
authored andcommitted
fix(pwa): set cacheid in GenerateSW mode only (#939)
close #891
1 parent a2ac6be commit 43971d8

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

packages/@vue/cli-plugin-pwa/index.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,20 @@ module.exports = (api, options) => {
2424
)
2525
}
2626

27-
const workBoxConfig = Object.assign({
28-
cacheId: name,
27+
const defaultOptions = {
2928
exclude: [
3029
/\.map$/,
3130
/img\/icons\//,
3231
/favicon\.ico$/,
3332
/manifest\.json$/
3433
]
35-
}, userOptions.workboxOptions)
34+
}
35+
36+
const defaultGenerateSWOptions = workboxPluginMode === 'GenerateSW' ? {
37+
cacheId: name
38+
} : {}
39+
40+
const workBoxConfig = Object.assign(defaultOptions, defaultGenerateSWOptions, userOptions.workboxOptions)
3641

3742
webpackConfig
3843
.plugin('workbox')

0 commit comments

Comments
 (0)