Update to workbox-webpack-plugin v4 #6725
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
DESCRIPTION:
Resolves Update Workbox to 4.1.0 #6659: Updated the
workbox-webpack-plugin
from v3 to latest v4 and also tested some of the new configuration options such asskipWaiting
andcleanupOutdatedCaches
after ejecting the app.Resolves Loading chunk XYZ failed (cont.) #6243: The new version automatically solves the issue where a registered service worker still tries to load an old resource, after workbox has cleaned up its old cache after an update.
TESTS COMPLETED:
Change the app code to
serviceWorker.register()
and runbuild
, then check if workbox caches the relevant files and if the service worker installs correctly and triggers theonSuccess
callback.Add flag
skipWaiting: true
to thewebpack.config.js
, then update the app code and perhaps also the version number inpackage.json
, then repeat the test above and check if the new service worker takes over the application and triggers theonUpdate
callback. Older outdated workbox caches should be deleted at the point (from logs visible on the dev console in localhost)Add flag
cleanupOutdatedCaches: false
, repeat the test above and check if the new service worker takes over the application. Older outdated workbox cache should not deleted now (this option is only available in versions 4.x.x and above).