"workbox-webpack-plugin": "^3.0.0-beta.2"
node v9.6.1, npm v5.6.0, Mac OSX 10.13.3, webpack 3.11.0
Using this plugin, the option globPatterns is not satisfied.
With following webpack conf :
config.plugins.push(
new InjectManifest({
swSrc: './src/service-worker.js',
globPatterns: ['**/*.{js,css}'],
})
)
My service-worer.js file is the following one :
workbox.precaching.precacheAndRoute(self.__precacheManifest || [])
I am getting following precache-manifest.js file :
self.__precacheManifest = [
{
"revision": "44194c6682f0b35d9351c7a745196fb1",
"url": "/dist/vue-ssr-client-manifest.json"
},
{
"url": "/dist/vendor.9d294b4ae54092e1d95d.js"
},
{
"url": "/dist/main.9d294b4ae54092e1d95d.js"
},
{
"url": "/dist/common.4e40b1a9c312f552eb9c.css"
},
{
"url": "/dist/1.9d294b4ae54092e1d95d.js"
},
{
"url": "/dist/0.9d294b4ae54092e1d95d.js"
}
];
I should not get first item in the manifest, "url": "/dist/vue-ssr-client-manifest.json"
Am I wrong ?
Hello @arthurmuchir鈥擨n v3, globPatterns only needs to be used if you want to precache additional assets that exist outside of the webpack build process: https://developers.google.com/web/tools/workbox/modules/workbox-webpack-plugin#cache_additional_non-webpack_assets
If you want to modify the webpack-generated assets that are precached, you can use the new include/exclude configuration options, documented at https://developers.google.com/web/tools/workbox/modules/workbox-webpack-plugin#full_injectmanifest_config
So, for example, you could do:
new InjectManifest({
swSrc: './src/service-worker.js',
exclude: [/\.map$/, /manifest.*\.json$/],
})
(which is a slight tweak of the default setting, [/\.map$/, /^manifest.*\.js(?:on)?$/]).
Thanks for the explanation
Most helpful comment
Hello @arthurmuchir鈥擨n v3,
globPatternsonly needs to be used if you want to precache additional assets that exist outside of the webpack build process: https://developers.google.com/web/tools/workbox/modules/workbox-webpack-plugin#cache_additional_non-webpack_assetsIf you want to modify the webpack-generated assets that are precached, you can use the new
include/excludeconfiguration options, documented at https://developers.google.com/web/tools/workbox/modules/workbox-webpack-plugin#full_injectmanifest_configSo, for example, you could do:
(which is a slight tweak of the default setting,
[/\.map$/, /^manifest.*\.js(?:on)?$/]).