-
Notifications
You must be signed in to change notification settings - Fork 831
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
self.__WB_MANIFEST is replaced only on the first occurrence #2681
Comments
This is a difference in behavior between workbox/packages/workbox-build/src/inject-manifest.js Lines 152 to 153 in f2ef912
I am going to standardize things so that The rationale behind this behavior is that the precache manifest might be lengthy, and storing multiple copies of it in the same service worker file is a waste of bytes. You can do the following if you'd like to, e.g., log it and also pass it to
|
Thanks. That's what I ended up doing indeed and I understand the rationale. However, can I recommend showing an error in the console if people try to replace it more than once? Right now, it silently fails and that made me spend quite a bit of time trying to debug this. |
Yup, I'm going to treat this as a compilation error in v6. |
i have the same error |
@tangdexin, please only include the symbol const manifest = self.__WB_MANIFEST;
// Do whatever you want with `manifest`:
if (manifest) {
console.log('precached', manifest);
precacheController.addToCacheList(manifest);
} |
It works , thanks very much |
version: "workbox-webpack-plugin": "6.6.0" const ignored = self.__WB_MANIFEST;
// precacheAndRoute(self.__WB_MANIFEST) This will cause same error in dev, but work well in build. |
Same issue here. Commented out __SW_MANIFEST counts as it is not commented out. |
Library Affected:
workbox-webpack-plugin
Browser & Platform:
Webpack 5
Workbox 6.0.0-rc.0
Issue Description:
I have this code in my service worker:
And this in the webpack config:
After building this (without minification), the output files has
self.__WB_MANIFEST
replaced with the manifest only on the first occurrence:Instead, the manifest should have been replaced in all occurrences.
The text was updated successfully, but these errors were encountered: