Workbox v3.0.0-alpha.4
Pre-release
Pre-release
🎉 What's New?
- #1138 Plugins can now be added to workbox-precaching; this is useful for adding plugins like
workbox-broadcast-cache-update
. - #1149
workbox-webpack-plugin
now supports{test, include, exclude}
-style filtering, providing an additional way of controlling which assets are included in the precache manifest. By default, assets matching/\.map$/
or/^manifest\.js(?:on)$/
are excluded. - #1154
workbox-precaching
supports two new configuration options,cleanUrls
andurlManipulation
. By defaultcleanUrls
is true and will check the precache for a with.html
on the end (i.e./about
will check for/about.html
.urlManipulation
can be a function enabling you to express a mapping between the server-side URL and the underlying local file.
🐛 What's Fixed?
- #1130 A cleaner service worker template.
- #1127, #1128, #1126, #1133, #1132 Various improvements to the test suite.
- #1139 Fix for an IDB bug, which could prevent v2 to v3 migrations from succeeding.
- #1155 Fix for a bug that could cause
workbox-background-sync
to enter a loop of repeated registrations.
⚠️ Breaking Changes
- #1137 The
importWorkboxFromCDN
boolean option, which was supported in previous v3 alpha releases ofworkbox-build
, has been replaced byimportWorkboxFrom
. Valid values forimportWorkboxFrom
are'cdn'
,'local'
,null
, or (when used from theworkbox-webpack-plugin
) the name of a webpack chunk. - #1143 The
workbox-webpack-plugin
module now exposes two top-level webpack plugins, namedGenerateSW
andInjectManifest
. Developers need to explicitly use one of these two plugins, depending on whether they want to create a new service worker file each time they run their build (GenerateSW
) or whether they want to use an existing service worker file but inject updated precache manifest information each time they build (InjectManifest
). - #1160 The valid
runtimeCaching
options have been updated, representing a break from the older syntax supported bysw-precache
. The following example contains the full set of currently supported options:
runtimeCaching: [{
urlPattern: /api/,
handler: 'networkFirst',
options: {
networkTimeoutSeconds: 10,
cacheName: 'my-api-cache',
expiration: {
maxEntries: 5,
maxAgeSeconds: 60,
},
cacheableResponse: {
statuses: [0, 200],
headers: {'x-test': 'true'},
},
broadcastUpdate: {
channelName: 'my-update-channel',
},
plugins: [
{cacheDidUpdate: () => /* custom plugin code */}
],
},
}]