📦 Workbox: JavaScript libraries for Offline Caching
Developed by GoogleChrome (Organization)
Primary language: JavaScript
October 6, 2017
October 21, 2017
JavaScript (618.07 kB), HTML (10.47 kB), CSS (145.00 bytes)
76
76
3121
106
Jeffrey Posnick on October 6, 2017 for Workbox 2.1.0
The 2.1.0 release fixes a longstanding issue in workbox-sw
that could cause routes established via router.registerRoute()
to inadvertently take precedence over the internal route that is intended for precached assets.
As described in this issue, the impacted code might look like:
// The internal route to serve the precached assets *should* have
// taken precedence... but prior to the 2.1.0 release, it didn't.
workboxSW.precache([]);
// This is a very broad wildcard match!
// Previously, it would cause precached assets to be served network-first.
// As of the 2.1.0 release, it will no longer apply to precached assets.
workboxSW.router.registerRoute(
'/*',
workboxSW.strategies.networkFirst()
);
Our documentation states that precached assets are always served via a cache-first route, so this previous behavior is considered a bug.
If, for some reason, your service worker depended on this buggy behavior, please update your code prior to upgrading to 2.1.0
.