-
Notifications
You must be signed in to change notification settings - Fork 830
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
workbox-precaching routes are not compatible with other packages #1857
Comments
Historically, there were members of the core team who felt that minimizing cross-module dependencies was a priority, so that using I am... less concerned about that, and in particular, if we assume that more folks are going to create custom Workbox bundles in the future, evaluating costs based on the full bundle size of a given module isn't necessarily as meaningful. |
For some more historical context, the v2 codebase had all of this logic inside of the common workbox/packages/workbox-sw/src/lib/workbox-sw.js Lines 131 to 146 in 5b97922
(I'm not arguing that we should return to that catch-all With v3, we started separating things out into self-contained modules with minimal overlap or cross-module code sharing. |
I do vote for @philipwalton for this, since it'll expose all options of workbox-strategies to precache eventually resolving issue #1760 and add great flexibility. By default it should depend on CacheFirst / CacheFirst strategy. |
Library Affected:
workbox-precaching
The
addRoute()
(and by extensionprecacheAndRoute()
) method inworkbox-precaching
adds its own fetch event listener + cache-first response logic rather than depending on theRouter
andRoute
modules fromworkbox-routing
and theCacheFirst
module fromworkbox-strategies
.This is not ideal for a few reasons:
addRoute()
andprecacheAndRoute()
offer) is not available to runtime routes.workbox-streams
code (instead, developers have to create their ownCacheFirst
strategy instances anyway).I'm sure there's historical reasons for (from the sw-precache/sw-toolbox merge), but I think we should explore whether it would be possible to consolidate these features in the future.
IMO, ideally,
workbox-precaching
would depend onworkbox-routing
andworkbox-strategies
, and the configuration options for customizing preaching routes could be added to theworkbox-routing
package and thus available to all routes.The text was updated successfully, but these errors were encountered: