Library Affected:
workbox-sw
Browser & Platform:
all.
Issue or Feature Request Description:
It is unclear what the order of conflicting routes is when caching for multiple routes.
e.g. If I have a workbox.strategies.networkFirst('/*' // ... and then later a workbox.strategies.cacheFirst('/index.html // ..., the priority appears to be set by the order in which the different strategies are called.
Is this a feature? Can I rely on it in my build process?
See this gist which applies to googlecodelabs/workbox-lab.
Apologies for the confusion.
Precedence is given to the last-registered route, with the idea that this gives developers the chance to override routes that were registered earlier on. The routing behavior should be stable for a given service worker configuration.
This isn't clear from the docs, so I'll repurpose this issue to track updating the route registration descriptions and examples.
For anyone looking at this comment, @jeffposnick has pointed out that his comment above is no longer true. (or at least my interpretation was incorrect).
Now, Workbox matches from specific to general鈥攊t'll check the first route, then second, etc.
https://developers.google.com/web/tools/workbox/modules/workbox-routing
Most helpful comment
Apologies for the confusion.
Precedence is given to the last-registered route, with the idea that this gives developers the chance to override routes that were registered earlier on. The routing behavior should be stable for a given service worker configuration.
This isn't clear from the docs, so I'll repurpose this issue to track updating the route registration descriptions and examples.