javascript - For ServiceWorker cache.addAll(), how do the URLs work? - Stack Overflow
cache.addAll treatment of '/' '/index.html', and other assets.
cache.addAll treatment of '/' '/index.html', and other assets.
Chrome docs on service worker lifecycle.
scope refers to where the request ORIGINATES, not the request URL - that may be outside of scope
Solution to write a service worker using VERSION + implementing “install“ event. These 2 together forces the browser to clear old cache on version change.
You have two options: Switch from your current cache-first strategy in your fetch handler to a strategy like stale-while-revalidate. Use a build-time tool to generate a service worker that changes each time one of your local resources changes, which will trigger the install and activate handlers, giving them a chance to update your users' caches with the latest copies of your assets. These tools work by generating hashes of each local file and inlining those hashes into the generated service worker script.
Best description of how service worker should handle caching - network first, cache first etc.
Only two events… In essence, there are only two events that will automatically trigger a PWA update: A change in the linked manifest.json; e.g. a changed icon file or a changed scope or start_url. A one-character change in the controlling service-worker.js. E.g., if you store the version number in a const in this file and change it, an update of the PWA will be triggered.