diff --git a/packages/@vue/cli-plugin-pwa/index.js b/packages/@vue/cli-plugin-pwa/index.js index bde560d26f..6f76d4004b 100644 --- a/packages/@vue/cli-plugin-pwa/index.js +++ b/packages/@vue/cli-plugin-pwa/index.js @@ -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')