-
Notifications
You must be signed in to change notification settings - Fork 147
BREAKING CHANGE: Update dependency workbox-webpack-plugin to v7 #457
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1b5fe73 to
4cda5d5
Compare
ebc482f to
8404072
Compare
d3a3483 to
2133d60
Compare
2133d60 to
9b60375
Compare
08da211 to
6696b83
Compare
1d2ec42 to
63f7088
Compare
5bcceb5 to
9b6f9e8
Compare
9b6f9e8 to
7761b35
Compare
04cd080 to
f110c12
Compare
b9bd367 to
cdc1a1c
Compare
2f437a9 to
c8aa473
Compare
401d734 to
a0e51e0
Compare
d1710cc to
d3576b5
Compare
d3576b5 to
78cbcbf
Compare
78cbcbf to
1f12f9d
Compare
1f12f9d to
c496b15
Compare
c496b15 to
ba06e8d
Compare
ba06e8d to
c8a5403
Compare
c8a5403 to
2d866b0
Compare
2d866b0 to
01f8d44
Compare
01f8d44 to
89567b9
Compare
89567b9 to
758e7b8
Compare
d740b52 to
c4a6b01
Compare
c4a6b01 to
4e9eba0
Compare
Contributor
Author
Renovate Ignore NotificationBecause you closed this PR without merging, Renovate will ignore this update. You will not get PRs for any future If you accidentally closed this PR, or if you changed your mind: rename this PR to get a fresh replacement PR. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR contains the following updates:
4.3.1->7.0.0Release Notes
googlechrome/workbox (workbox-webpack-plugin)
v7.0.0: Workbox v7.0.0Compare Source
v6.6.1Compare Source
v6.6.0Compare Source
v6.5.4Compare Source
What's New 👀
configproperty [#3056]workbox-precachingduring a fall back to the network, if the request'smodeisno-cors,integritywill not be used and the cache entry will not be repaired. [#3099]What's fixed 🐛
Misc 🤹
idbandselenium-assitantversionsThank yous 🌿
Full Changelog: GoogleChrome/workbox@v6.5.3...v6.5.4
v6.5.3Compare Source
v6.5.2: Workbox v6.5.2Compare Source
Workbox v6.5.2 includes a number of improvements to the TypeScript documentation and exported types, which should in turn improve the generated documentation.
A full changelog is available at GoogleChrome/workbox@v6.5.1...v6.5.2
v6.5.1: Workbox v6.5.1Compare Source
The Workbox v6.5.1 release includes a few changes related to our TypeScript interfaces and documentation.
A full changelog is available at GoogleChrome/workbox@v6.5.0...v6.5.1
What's New
@examples of using our build tools have been added to the TSDocs forworkbox-buildandworkbox-webpack-plugin. [#3038]generateSW(),injectManifest(), andgetManifest()methods inworkbox-buildhas been updated fromunknownto an appropriate actual type specific to each method. This should lead to better TSDoc generation and type inferences for developers. As this takes what was previously only a runtime check and moves it to a compile-time check, we believe that it should be functionally equivalent to prior releases, but if you run into problems, please let us know by opening an issue. [#3037]What's Fixed
defaultexport toworkbox-webpack-plugin. [#3036]v6.5.0: Workbox v6.5.0Compare Source
The Workbox v6.5.0 release includes a number of smaller fixes, as well as a major rewrite of the
workbox-webpack-pluginto TypeScript.A full changelog is available at GoogleChrome/workbox@v6.4.2...v6.5.0
What's New
workbox-webpack-pluginhas been rewritten in TypeScript, and has public TypeScript definitions for its interfaces published as part of this release. We do not anticipate any changes in the underlying functionality as part of this rewrite. [#2882]forceSyncFallbackparameter has been added toworkbox-background-sync, without changing the default behavior. WhenforceSyncFallbackis explicitly set totrue,workbox-background-syncwill always attempt to replay queued requests when the service worker starts up and never rely on thesyncevent listener. Most developers will not need this behavior, but it can be useful when targeting environments that have a non-functional Background Sync implementation, like some Electron runtimes. [#3020]What's Fixed
workbox-streams. [#3001]workbox-background-syncwhich could lead to errors when run through with certain aggressive minifiers. [#3012]waitUntil()was added to theStaleWhileRevalidatestrategy, ensuring that it works properly with navigation preload responses. [#3015]source-map-urlpackage. [#3031]New Contributors
Thank you to @roikoren755 for their contributions to the
workbox-webpack-pluginTypeScript migration!v6.4.2: Workbox v6.4.2Compare Source
The Workbox v6.4.2 release fixes a few issues:
What's Changed
@apideck/better-ajv-errorsto ^0.3.1 by @wopian in https://github.com/GoogleChrome/workbox/pull/2988ExpirationPlugindocs by @mungojam in https://github.com/GoogleChrome/workbox/pull/2987workbox wizard --injectManifestby @jeffposnick in https://github.com/GoogleChrome/workbox/pull/2992New Contributors
Full Changelog: GoogleChrome/workbox@v6.4.1...v6.4.2
v6.4.1: Workbox v6.4.1Compare Source
The Workbox v6.4.1 release fixes a few issues:
🐛 What's Fixed?
workbox-build
@apideck/better-ajv-errorshas been updated, which in turn addresses a security issue in one of its dependencies. [#2977]worbox-navigation-preload
preloadResponsewas incorrect, and has been fixed to reflect the previous definition that used to be provided by the TypeScript standard library. [#2975]worbox-strategies
request.urlinto account inStrategyHandler.getCacheKey(). This ensures if a custom strategy overrides theStrategy._handle()method and performs multiple cache operations on different URLs, the cache key is properly calculated for each distinct URL. [#2973]v6.4.0: Workbox v6.4.0Compare Source
Workbox v6.4.0 includes:
🎉 What's New?
worbox-background-sync
size(). [#2941]🐛 What's Fixed?
injectManifest. It returns now returns a warning and continues with execution. [#2959]🎁 Thank you
To our new contributors in this version: @StephanBijzitter and @fuzail-ahmed!
v6.3.0: Workbox v6.3.0Compare Source
Workbox v6.3.0 includes a couple of bug fixes and several new features.
🎉 What's New?
Allow precaching "repair" when using subresource integrity
Although unexpected, there are edge cases where the precache might not be in an inconsistent state, most likely due to a developer manually deleting something in DevTools.
When this happens,
workbox-precachingdefaults to falling-back to using a network response (assuming the device is online) when there's a precaching miss. Up until now,workbox-precachinghasn't attempting to use this network response to repopulate the precache, because there are no guarantees that the network response corresponds to the version of the asset specified in the precache manifest.However, if the precache entry includes an
integrityproperty, then subresource integrity guarantees that the response does correspond to the same version of the asset in the manifest. So it should be safe to "repair" the cache with that response. [#2921]IDB writes use relaxed durability
This small change to the way Workbox writes to IndexedDB should lead to slightly better performance, without any appreciable downsides. [#2934]
notifyAllClients option in BroadcastCacheUpdate
BroadcastCacheUpdateusespostMessage()to notify all open tabs controlled by the current service worker about a cache update. This default behavior is not changing.Setting
notifyAllClients: falsewhen configuringBroadcastCacheUpdateand the associated plugin will result inpostMessage()only communicating the update to the specificwindowclient that triggered thefetchrequest which resulted in the cache update. [#2920]All WorkboxEvents TypeScript types are now exported
This enhancement makes it easier to use TypeScript to write
workbox-windowevent handlers. [#2919]Debug logging when caching responses with Vary: headers
The presence of
Vary:headers on a cachedResponsecan make it difficult to properly match and delete cache entries. To make it clearer to developers when this is happening, the development builds of Workbox will now log a message to theconsolewhen aResponsethat's being cached includes aVary:header. [#2916]🐛 What's Fixed?
workbox-cli
chokidardependency, for betternodecompatibility and to eliminate security warnings. [#2913]workbox-precaching
PrecacheCacheKeyPlugin. [#2914]v6.2.4: Workbox v6.2.4Compare Source
🐛 What's Fixed?
onSyncandhandleringenerateSW'sruntimeCachingshould not fail validation. [#2911]v6.2.3: Workbox v6.2.3Compare Source
🐛 What's Fixed?
@types/trusted-typestodependenciesofworkbox-window[#2909]v6.2.2: Workbox v6.2.2Compare Source
Workbox v6.2.2 fixes a few bugs introduced in the v6.2.0 release.
🐛 What's Fixed?
Validation fix for plugin functions passed to
runtimeCachingin the build tools. [#2901]Ensure that our
tscconfiguration transpiles newer language features down to the ES2017targetlevel. [#2902]Update to our
lernaconfiguration to use the--exacttag when publishing tonpm, to ensure that all the mutual dependencies in the monorepo use exact version matches, and not^versions. [#2904]v6.2.1Compare Source
v6.2.0: Workbox v6.2.0Compare Source
Workbox v6.2.0 includes a number of bug fixes and internal refactoring described below.
Our intention is not to include any breaking changes in v6.2.0, and we've made an effort to maintain the same public interfaces and general behaviors while rewriting some of Workbox's internals.
🎉 What's New?
workbox-build TypeScript rewrite
The
workbox-buildmodule has been rewritten in TypeScript, following the earlier migration of theworkbox-climodule. (workbox-webpack-pluginhas not yet been migrated.) Developers who useworkbox-buildfrom their own TypeScript code should benefit from the official, accurate type definitions that are now published alongsideworkbox-build. [#2867]Build tool option validation
As part of this change,
workbox-buildnow uses the TypeScript definitions as the source of truth when validating the configuration options developers provide. Previously,joiwas used for validation with its own set of schema, and this would sometimes lead to mismatches between what the validation logic thought was okay and what the code actually expected. Developers who inspect the validation errors returned byworkbox-buildwill likely see different error strings in v6.2.0. We expect that moving forward, using TypeScript as the source of truth will lead to fewer of those mismatches.This change applies to bothworkbox-cliandworkbox-webpack-plugin, as well, which rely onworkbox-buildunder the hood.IndexedDB code migration
Another refactoring is the replacement of our previous custom IndexedDB logic with the
idblibrary. No developer-visible changes are expected due to this migration. [#2838]Multiple controlling events during a page's lifetime
Following this change,
worbox-window'scontrollingevent is fired each time the underlyingoncontrollerchangeevent happens. Multiplecontrollingevents can occur on a long-lived page in which multiple service worker updates take place.isExternal: truewill be set when the service worker that takes control is "external," which will always be the case for multiple updates.Previously,
controllingwould only be fired once per lifetime of the page, which does not match the documented behavior. This change is considered a bug fix to match the expected behavior, and developers are encouraged to test their logic to ensure that they were not relying on the previous, buggy behavior. [#2817]TrustedScriptURL support in workbox-window
Developers who have opted-in to the CSP policy
"require-trusted-types-for 'script'"and who are using TypeScript would have previously had trouble usingTrustedScriptURLs inworkbox-window. This release improves that support. [#2872]rangeRequests option in runtimeCaching
Setting
rangeRequests: trueinside of aruntimeCachingconfiguration entry will add the RangeRequestsPlugin to the service worker generated by Workbox's build tools. [#2871]🐛 What's Fixed?
workbox-core
HandlerDidErrorCallbackParamtype definition is now exported alongside the other relevant TypeScript types. [#2886]workbox-webpack-plugin
webpack'seval-cheap-source-mapis used along with theInjectManifestplugin. [#2847]workbox-window
portswas missing on theWorkboxMessageEvent. It's been added, mirroring the value of the underlyingMessageEvent, when used in anonmessagehandler. [#2874]The
WorkboxEventMaptype definition is now exported alongside the other relevant TypeScript types. [#2870]Thanks!
Thank you @rockwalrus for contributing a PR [#2857] that went into this release!
v6.1.5: Workbox v6.1.5Compare Source
Workbox v6.1.5 includes fixes in
workbox-cli,workbox-windowandworkbox-webpack-plugin. Also, therollupand@rollup/plugin-node-resolvedependencies were updated.(There was no v6.1.3 or v6.1.4 release.)
🐛 What's Fixed?
workbox-cli
In the configuration file generated by
workbox wizardthe regex forignoreURLParametersMatchingare now serialized correctly, as before they were being serialized as strings and that was causing errors. [#2796]workbox-window
Added support for external controlling events. The
controllingevent is now dispatched whether it originated in the current or external service worker. Developers can check theisExternalflag to distinguish between the two. [#2786]workbox-webpack-plugin
Fix to push an Error object to
compilation.warningsinstead of strings, since pushing strings causes the warnings to not be bubbled up correctly. See [#2790]Thanks!
Thank you @jcabak for contributing documentation updates [#2808]!
v6.1.2: Workbox v6.1.2Compare Source
Workbox v6.1.2 includes several fixes to the
workbox-cli'swizardmode, and removes some potentially confusing logging.🐛 What's Fixed?
workbox-build
workbox-buildwas used, due to an update to the@rollup/plugin-replaceplugin that it uses. The underlying issue raised in the warning message has been addressed. [#2772]workbox-cli
Previously, the
wizardquestion flow would not give developers the opportunity to specify a value to override the defaultignoreURLParametersMatchingsetting. Thewizardnow provides some context and explicitly asks about overriding this value. [#2763]There were two issues fixed in the
wizardrelated to entering theglobDirectoryvalue: the separator characters,--------, were inadvertently selectable, and additionally, the logic was buggy when a manual directory name was entered. Both of these issues are fixed. [#2766]workbox-strategies
Thanks!
Special thanks to @ognjenjevremovic for contributing the two
workbox-cliPRs that went into this release!v6.1.1: Workbox v6.1.1Compare Source
Workbox v6.1.1 includes a bug fix for the
NetworkFirststrategy, as well as some documentation and TypeScript fixes.🐛 What's Fixed?
workbox-strategies
The
NetworkFirststrategy uses two promises: one for the network request, and one is the optionalnetworkTimeoutSecondsoption is set. If the network request succeeds, then the timeout promise's timer is canceled. However, the strategy previously attempted to wait until both promises resolve before the handler resolves. This meant that, if the network request succeeds before the timeout, the strategy's over handler promise would not properly resolve.See #2744
Thanks!
Special thanks to @joshkel for both bringing that
NetworkFirstissue to our attention, as well as contributing the code for the fix!v6.1.0: Workbox v6.1.0Compare Source
Workbox v6.1.0 includes a number of new features, as well as an important fix for a bug that could have affected
workbox-precachingbehavior in earlier v6 releases.🎉 What's New?
setCatchHandler for individual Routes
The
setCatchHandler()method on aRouterallows you to configure "fallback" logic if any handler invoked by thatRouterreturns an error. It can be awkward to use, however, if you have many differentRoutes registered for the sameRouter, and you would prefer that the fallback logic only be invoked when one or two particularRoutehandlers fail.Starting in this release, each individual
Routeobject has asetCatchHandler()method, allowing you to add fallback logic just to thatRoute, without affecting any otherRoutes. To use this method, make sure you explicitly construct aRoutefirst, and then pass thatRouteto the (overloaded)registerRoute()method:See #2699
New "recipes"
The
workbox-recipesmodule has been extended with a few new features:warmStrategyCache, which takes an array of paths and a Workbox strategy and warms that strategy's cache with those paths at service worker install time.warmCacheoption to page, image, and static resource recipes to allow users to warm those caches.pluginsoption to page, image, and static resource recipes to allow users to pass additional plugins to those recipes, allowing a user, for instance, to add a URL normalization plugin to the page recipe.The
workbox-recipesdocumentation has more information and examples.See #2718
🐛 What's Fixed?
workbox-precaching
The expected behavior for
workbox-precachingis that all URLs listed in the precache manifest need to be considered "cacheable" in order for service worker installation to succeed. By default,workbox-precachingconsiders any response with astatuscode less than400as being cacheable (including opaque responses, which have a status code of0). Developers who need to customize this behavior can pass acacheWillUpdateplugin toworkbox-precaching, and use that logic to determine whether or not a response should be precached during installation.Two bugs were introduced in the Workbox
v6.0.0release:The default criteria, in which any response with a status of
400or higher should be considered uncacheable, would lead to the invalid response being inadvertently written to the cache prior to failing the service worker installation. The next time installation was attempted, this previously cached error response wouldn't be retried, so after enough retries, the service worker would eventually finish installation, even though some responses that should have been considered invalid were precached.If a developer uses a
cacheWillUpdateplugin while precaching, returningnullfrom the plugin properly excluded that response from being precached, but it would not cause the overall service worker installation to fail.Both of these bugs are fixed in the
v6.1.0release. During service worker installation, if any response that is uncacheable (either via the default or customcacheWillUpdatecriteria) is encountered, installation will consistently fail and the invalid response won't be added to the cache.See #2738
workbox-webpack-plugin
chunksorexcludeChunksoptions could lead to a warning message under some circumstances, due toworkbox-webpack-pluginassuming they always corresponded to chunk group names. The code will now check to see if the name matches a chunk itself, not just a group. See #2735All build tools
source-mapdependency has been updated to resolve an issue that could occur when run in a Node environment that had a polyfilledfetch(). See #2716Thanks!
Special thanks to @Spiderpig86 for contributing a PR that was part of this release.
v6.0.2: Workbox v6.0.2Compare Source
Workbox v6.0.2 resolves an issue that could prevent
workbox-precachingfrom working as expected when loaded viaworkbox-sw.(There was no v6.0.1 release.)
🐛 What's Fixed?
_handle. [#2687]Thanks!
Special thanks to @pidtuner for raising the issue that was resolved in this release.
v6.0.0: Workbox v6.0.0Compare Source
Overview of Workbox v6
We're happy to announce the release of Workbox v6!
🎉 What's New?
webpack improvements
This release includes additional bug fixes for better compatibility with
webpack. As of this release,workbox-webpack-pluginrequireswebpackv4.40.0 or later (for those still on the v4.x branch) orwebpackv.5.9.0 or later (for those who have updated towebpackv5.x).workbox-webpack-pluginwill also now take advantage of theimmutablemetadata thatwebpackautomatically adds to hashed assets. In most cases, this means that explicitly usingdontCacheBustURLMatchingin yourworkbox-webpack-pluginconfiguration is no longer necessary.See #2651, #2673, and #2675.
workbox-strategies improvements
The best way to ensure third-party developers have the power to extend Workbox in ways that fully meet their needs is to base our own strategies on top of the extensibility mechanisms we expose to third-party developers.
Specifically, v6 introduces a new way for third-party developers to define their own Workbox strategies, and all of our built-in strategies have been rewritten on top of this mechanism.
This change also allowed us to rewrite the
workbox-precachingcodebase to useworkbox-strategiesas a base. This should not result in any breaking changes, and should lead to better long-term consistency in how the two modules access the network and cache.See #2446, #2459 and #2569 for more details.
New strategy base class
In v6, all Workbox strategy classes (both built-in strategies as well as custom, third-party strategies) must extend the new
Strategybase class.The
Strategybase class is responsible for two primary things:A new "handler" class
We previously had internal modules call
fetchWrapperandcacheWrapper, which (as their name implies) wrap the various fetch and cache APIs with hooks into their lifecycle. This is the mechanism that currently allows plugins to work, but it's not exposed to developers.The new "handler" class (which this proposal calls
StrategyHandler) will expose these methods so custom strategies can callfetch()orcacheMatch()and have any plugins that were added to the strategy instance automatically invoked.This class would also make it possible for developers to add their own custom, lifecycle callbacks that might be specific to their strategies, and they would "just work" with the existing plugin interface.
New plugin lifecycle state
In Workbox v5, plugins are stateless. That means if a request for
/index.htmltriggers both therequestWillFetchandcachedResponseWillBeUsedcallbacks, those two callbacks have no way of communicating with each other or even knowing that they were triggered by the same request.In this proposal, all plugin callbacks will also be passed a new
stateobject. This state object will be unique to this particular plugin object and this particular strategy invocation (i.e. the call tohandle()).This allows developers to write plugins where one callback can conditionally do something based on what another callback in the same plugin did (e.g. compute the time delta between running
requestWillFetchandfetchDidSucceedorfetchDidFail).New plugin lifecycle callbacks
In order to fully leverage the plugin lifecycle state (mentioned above), you need to know when the lifecycle of a given strategy invocation starts and finishes.
To address this need (and others), the following new plugin lifecycle callbacks will be added:
handle()method returns a response. This callback can be used to modify that response before returning it to a route handler or other custom logic.handle()method returns a response. This callback can be used to record any final response details, e.g. after changes made by other plugins.Developers implementing their own custom strategies do not have to worry about invoking these callbacks themselves; that's all handled by a new
Strategybase class.More accurate TypeScript types for handlers
TypeScript definitions for various callback methods have been normalized. This should lead to a better experience for developers who use TypeScript and write their own code to implement or call handlers.
See #2548.
workbox-recipes
This release includes a new module,
workbox-recipes, that combines common routing and caching strategy configurations into ready-to-use code that can be dropped in to your service worker.You can read more about what's included in the first batch of recipes, as well as how to use them, in #2664.
workbox-window improvements
New messageSkipWaiting() method
A new method,
messageSkipWaiting(), has been added to theworkbox-windowmodule to simplify the process of telling the "waiting" service worker to activate.This offers some improvements over alternatives:
It calls
postMessage()with the de facto standard message body,{type: 'SKIP_WAITING'}, that a service worker generated by Workbox checks for to triggerskipWaiting().It chooses the correct "waiting" service worker to post this message to, even if it's not the same service worker that
workbox-windowwas registered with.See #2394.
Removal of "external" events in favor of an isExternal property
Many developers were confused by the concept of "external" events in
workbox-window, and in practice, they did not end up being a net-positive.All "external" events are now represented as "normal" events with an
isExternalproperty set totrue. This allows developers who care about the distinction to still detect it, and developers who don't need to know can ignore the property.See #2031.
Cleaner "Offer a page reload for users" recipe
Taken together, these two changes make the "Offer a page reload for users" recipe cleaner:
sameOrigin parameter in matchCallback functions
A new boolean parameter,
sameOrigin, is passed to thematchCallbackfunction used inworkbox-routing.It's set totrueif the request is for a same-origin URL, andfalseotherwise.This simplifies some common boilerplate:
See #2487.
matchOptions are supported in workbox-expiration
You can now set
matchOptionsinworkbox-expiration, which will then be passed through as theCacheQueryOptionsto the underlyingcache.delete()call. (Most developers won't need to do this.)See #2206.
Precaching now processes entries one by one, not in bulk
workbox-precachinghas been updated so that only one entry in the precache manifest is requested and cached at a time, instead of attempting to request and cache all of them at once (leaving it to the browser to figure out how to throttle).This should reduce the likelihood of
net::ERR_INSUFFICIENT_RESOURCESerrors while precaching, and also should reduce the bandwidth contention between precaching and simultaneous requests made by the web app.See #2528.
PrecacheFallbackPlugin allows for easier offline fallback
workbox-precachingnow includes aPrecacheFallbackPlugin, which implements the newhandlerDidErrorlifecycle method added in v6.This makes it easy to specify a precached URL as a "fallback" for a given strategy when a response otherwise wouldn't be available. The plugin will take care of properly constructing the correct cache key for the precached URL, including any revision parameter that's needed.
Here's a sample of using it to respond with a precached
/offline.htmlwhen theNetworkOnlystrategy can't generate a response for a navigation request—in other words, displaying a custom offline HTML page:precacheFallback in runtime caching
If you're using
generateSWto create a service worker for you instead of writing your service worker by hand, you can use the newprecacheFallbackconfiguration option inruntimeCachingto accomplish the same thing:Under-the-hood workbox-precaching improvements
This release includes a substantial rewrite to the implementation of
workbox-precaching, to build on top of other standard Workbox idioms (likeRoutes,Strategysubclasses, and custom plugins) as much as possible. There are a few breaking changes, described in the follow section, but they are mostly limited to uncommon use cases, whenPrecacheControlleris instantiated directly. For the most part, these changes are meant to be invisible to developers, but should lead to be better consistency in how routing and request handling works across all of Workbox.You can read more about what's change in #2638
cacheKeyWillBeUsed can be used to cache non-GET requests
Only
GETrequests can be used as cache keys, but there are scenarios in which you might want to use a combination of plugins to transform aPOSTorPUTrequest into a cacheableGETrequest.You can now use the
cacheKeyWillBeUsedlifecycle callback in a plugin to return aGETrequest with whatever URL you'd like to use as a cache key, and that can then allow the response associated with aPOSTorPUTto be cached.See #2615 for more details. Thanks to @markbrocato for their contribution.
Build Tools
The minimum required version of node has been increased to
v10.0.0. This applies toworkbox-build,workbox-cli, andworkbox-webpack-plugin. [#2462]modewas not intended to be a supported parameter for theinjectManifestandgetManifestmodes ofworkbox-buildandworkbox-cli. It's been removed from the documentation and attempting to use it outside ofgenerateSWwill now trigger a build error. This does not apply toworkbox-webpack-plugin, which does supportmodein itsInjectManifestplugin. [#2464]workbox-core
skipWaiting()method inworkbox-corewrapped the underlying call toself.skipWaiting()in aninstallhandler. In practice, this caused undue confusion and offered little value, as it's valid to callself.skipWaiting()outside of aninstallevent. As of v6, Workbox'sskipWaiting()will no longer add in aninstallhandler, and is equivalent to just callingself.skipWaiting(). Because of this, developers should migrate to callingself.skipWaiting()directly, and Workbox'sskipWaiting()will likely be removed in v7. [#2547]workbox-precaching
While this scenario is uncommon, if you precache a URL that corresponds to an HTTP redirect to an HTML document on a different origin, that cross-origin HTML document can no longer be used to satisfy a navigation request. [#2484]
By default, the
fbclidURL query parameter is now ignored when looking up a precached response for a given request. [#2532]Note: The following changes primarily apply to direct usage of the
PrecacheControllerclass. Most developers don't usePrecacheControllerdirectly, and instead use static helper methods likeprecacheAndRoute()exported byworkbox-precaching. [#2639]The
PrecacheControllerconstructor now takes in an object with specific properties as its parameter, instead of a string. This object supports the following properties:cacheName(serving the same purpose as the string that was passed in to the constructor in v5),plugins(replacing theaddPlugins()method from v5), andfallbackToNetwork(replacing the similar option that was passed tocreateHandler()and `createHandlerBoundToURL() in v5).The
install()andactivate()methods ofPrecacheControllernow take exactly one parameter, which should be set to a correspondingInstallEventorActivateEvent, respectively.The
addRoute()method has been removed fromPrecacheController. In its place, the newPrecacheRouteclass can be used to create a route that you can then register.The
precacheAndRoute()method has been removed fromPrecacheController. (It still exists as a static helper method exported by theworkbox-precachingmodule.) It was removed becausePrecacheRoutecan be used instead.The
createMatchCalback()method has been removed fromPrecacheController. The newPrecacheRoutecan be used instead.The
createHandler()method has been removed fromPrecacheController. Thestrategyproperty of thePrecacheControllerobject can be used to handle requests instead.The
createHandler()static export has already been removed from theworkbox-precachingmodule. In its place, developers should construct aPrecacheControllerinstance and use itsstrategyproperty.The route registered with
precacheAndRoute()is now a "real" route that usesworkbox-routing'sRouterclass under the hood. This may lead to a different evaluation order of your routes if you interleave calls toregisterRoute()andprecacheAndRoute(). See #1857 and #2402 for more details.workbox-routing
setDefaultHandler()method now takes an optional second parameter corresponding to the HTTP method that it applies to, defaulting to'GET'. It no longer applies to requests with any HTTP method. If you were usingsetDefaultHandler()and all of your web app's requests are'GET', then no changes need to be made. [#2463]workbox-webpack-plugin
v4.40.0(for users remaining on the webpackv4.xmajor release) orv5.9.0(for users who have updated to the webpackv5.xmajor release). [#2641]v5.1.4: Workbox v5.1.4Compare Source
The v5.1.4 release contains a dependency update for
rollup-plugin-terser, resolving a security error with one of its dependencies.See https://github.com/GoogleChrome/workbox/issues/2601
v5.1.3: Workbox v5.1.3Compare Source
🐛 What's Fixed?
workbox-buildworkbox-build'sgetManifest()JSDoc [#2429]workbox-cliswSrcfor hardcoded injection point inwizardflow [#2451]workbox-corehandlerCallbackJSDocs update [#2440]workbox-precachingisSWEnvassertion [#2453]is[#2466]Thanks!
Special thanks to @akonchady for contributing a PR that went in to this release.
v5.1.2: Workbox v5.1.2Compare Source
🐛 What's Fixed?
workbox-buildstrip-commentsdependency to an earlier revision, to provide continued compatibility with the v8.x.y releases ofnode. [#2416]Thanks!
Special thanks to @Mister-Hope for raising issues that were resolved in this release.
v5.1.1: Workbox v5.1.1Compare Source
(We ran into some issues with the
v5.1.0release process, sov5.1.1is a republish of the same code.)🎉 What's New?
workbox-routinghashportion is displayed. [#2371]workbox-webpack-plugincompileSrcoption (defaulting totrue) has been added. If set tofalse, thenwebpackwill not run theswSrcfile through a compilation. This can be useful if you want yourswDestoutput to be, e.g., a JSON file which contains your precache manifest. [#2412]🐛 What's Fixed?
workbox-webpack-pluginwebpackmodules. [#2397]webpackCompilationPluginsthat customize theswSrccompilation should now be properly applied. [#2400]Thanks!
Special thanks to @aritsune, @bailnl, @novaknole and @pizzafox for raising issues that were resolved in this release.
v5.1.0Compare Source
v5.0.0: Workbox v5.0.0Compare Source
Overview of Workbox v5
We're happy to announce the release of Workbox version 5! This release introduces a lot of new features, as well as some breaking changes.
If you're already using Workbox, the best place to get up to speed is the guide to migrating from v4 to v5.
One example migration, with commentary, can be found in this GitHub commit.
🎉 What's New?
A shift towards local Workbox bundles & away from the CDN
While our immediate plan is to continue publishing copies of the Workbox runtime code to our CDN, in v5, the
generateSWmode of our build tools will create a local bundle of exactly the Workbox runtime methods you end up using in your service worker. Depending on the value ofinlineWorkboxRuntime, this bundle will either be imported from a separate file, or inlined directly in your top-level service worker.Under the hood, we use Rollup to create this optimized bundle, optionally minifying it and generating sourcemaps, depending on the configuration.
See #2064 for more details.
If you're using the
workbox-webpack-plugin'sInjectManifestmode, the service worker file you specify viaswSrcwill end up being run through awebpackcompilation process, optionally applying any compilation plugins configured via thewebpackPluginsparameter. This should simplify the development flow described in the Using Bundlers (webpack/Rollup) with Workbox guide.See #1513 for more details.
You can continue using
importScripts('http://storage.googleapis.com/workbox-cdn/releases/5.0.0/workbox-sw.js')and relying onworkbox-swto dynamically pull in the Workbox runtime code that you need in v5, but we expect that using a custom bundle will lead to smaller runtime payloads (as well as work around issues with asynchronous imports), and we encourage developers to consider switching off of the CDN.Changes to the webpack precache manifest
Before v5,
workbox-webpack-pluginwould generate a list of entries to precache based on two distinct sources: the set of assets in awebpackcompilation, along with an optional additional set of files matched viaglobpatterns. Mostwebpackdevelopers did not use theglob-related options (since thewebpackcompilation would normally include all the assets that they cared about), but at the same time, some helpful configuration options for manipulating or post-processing the precache manifest only applied to entries created via thoseglobpatterns.In v5, the
glob-related configuration options are no longer supported. Thewebpackasset pipeline is the source of all the automatically created manifest entries. (Developers who have files that exist outside of thewebpackasset pipeline arConfiguration
📅 Schedule: Branch creation - "after 10pm every weekday,before 5am every weekday,every weekend" (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Mend Renovate. View repository job log here.