I am using workbox wizard to create the workbox-config.js as the documentation states:
My config looks like this:
module.exports = {
"globDirectory": "public/",
"globPatterns": [
"**/*.{ico,html,png,json,txt}"
],
"swDest": "public/sw.js",
"swSrc": "src/sw.js",
"injectionPointRegexp": /(const precacheManifest = )\[\](;)/
}
I get following error when trying to inject the manifest:
✘ alxxo@Axxxx ~/Documents/coda/pwa-xx workbox ●✚ workbox injectManifest workbox-config.js
Using configuration from /xxxxx/workbox-config.js.
Your configuration is invalid:
{
"globDirectory": "public/",
"globPatterns": [
"**/*.{ico,html,png,json,txt}"
],
"swDest": "public/sw.js",
"swSrc": "src/sw.js",
"injectionPointRegexp" [1]: {}
}
[1] "injectionPointRegexp" is not a supported parameter.
How can it be not a supported parameter if it appears in the documentation?
I'm assuming you're using the latest version of Workbox.
If you're using Workbox v5 or higher, then the correct parameter name is injectionPoint
. Instead of a RegExp, you now pass in a string if you need to override the default.
The default behavior in v5 is to look for the symbol self.__WB_MANIFEST
somewhere in your swSrc
file, and replace that with the precache manifest.