Workbox v3.0.0-alpha.5
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-pluginnow 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-precachingsupports two new configuration options,cleanUrlsandurlManipulation. By defaultcleanUrlsis true and will check the precache for a with.htmlon the end (i.e./aboutwill check for/about.html.urlManipulationcan 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-syncto enter a loop of repeated registrations. - #1168 A fix for broken expiration.
⚠️ Breaking Changes
- #1137 The
importWorkboxFromCDNboolean option, which was supported in previous v3 alpha releases ofworkbox-build, has been replaced byimportWorkboxFrom. Valid values forimportWorkboxFromare'cdn','local',null, or (when used from theworkbox-webpack-plugin) the name of a webpack chunk. - #1143 The
workbox-webpack-pluginmodule now exposes two top-level webpack plugins, namedGenerateSWandInjectManifest. 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
runtimeCachingoptions 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 */}
],
},
}]