npm workbox-precaching 4.0.0-rc.0
Workbox v4.0.0-rc.0

latest releases: 7.1.0, 7.0.0, 6.6.1...
5 years ago

The latest RC release of Workbox v4 includes the following developer-visible changes, in addition to all the changes from the previous pre-releases.

🎉 What's New?

workbox-window

  • The addition of a scriptVersion option to the Workbox constructor in beta.2. has been reverted, as well as the change to the function signature. The Workbox function signature is now the same as it was in beta.1 [#1876]:
new Workbox(scriptURL, registerOptions);

workbox-google-analytics

  • If you use Google Tag Manager (GTM) to load Google Analytics on your site, Workbox will now cache the gtm.js library so it will work offline as well [#1869].

workbox-expiration and workbox-broadcast-update

The npm names of these two packages has change to reflect their browser namespace.

  • workbox-cache-expiration ➡️ workbox-expiration
  • workbox-broadcast-cache-update ➡️ workbox-broadcast-update

This change only affects developers who bundle their service worker from npm dependencies. Developers who load Workbox using workbox-sw should not have to change their code. [#1879]

⚠️ Breaking Changes

workbox-expiration

  • The underlying IndexedDB data model for cached entry metadata has changed from using IndexedDB database names that match the cache name (one database per cache name) to a single database named workbox-expiration. If you had code that was manually inspected this metadata, you'll need to update it to check the new database [#1883].

🐛 What's Fixed?

workbox-window

  • workbox-window scripts were not being copied when using the copyLibraries in workbox-build and workbox-cli. This has been fixed [#1871].

workbox-expiration

  • The workbox-expiration documentation states that the maxAgeSeconds option will expire entires based on the time they were last accessed. But due to a bug in the logic, it would actually expire entries based on the time they were originally cached. This has been fixed, and the behavior now matches the documentation [#1883].

workbox-build

  • After changes to workbox-precaching in beta.1, using the navigationFallback option in workbox-build wouldn't work if your fallback URL had precach metadata added to it. This has been fixed in workbox-build, but anyone using workbox.routing.registerNavigationRoute() and passing it a precached URL will likely need to update their code to use workbox.precaching.getCacheKeyForURL() as well:
// This won't work anymore.
workbox.routing.registerNavigationRoute(myPrecachedURL);

// Instead, do this:
workbox.routing.registerNavigationRoute(
  workbox.precaching.getCacheKeyForURL(myPrecachedURL)
);

Don't miss a new workbox-precaching release

NewReleases is sending notifications on new releases.