scottohara / tvmanager

PWA for tracking recorded, watched & upcoming TV shows
MIT License
4 stars 0 forks source link

Workbox no-op service worker #96

Closed scottohara closed 2 years ago

scottohara commented 4 years ago

In v2, the handleFetch: false option allowed for the case in development where a service worker to be registered/installed, but would pass through all requests to the network.

In v3, this option was dropped; and the general guidance was for developer to use the DevTools "Bypass for network" setting.

This arguably is more flexible, as it allows the individual developer to toggle the service worker as required, but is less convenient than having it disabled by default in Dev builds and enabled by default in prod builds.

https://github.com/GoogleChrome/workbox/issues/2272

scottohara commented 3 years ago

For now, a note has been added to the README:

(Tip: In Chrome DevTools > Application > Service Workers, enable the "Update on reload" option so that all changes appear immediately on reload)

This was added as part of the switch to using webpack-dev-server for things like live reload instead of webpack --watch.

Ideally if Chrome DevTools persisted the these SW settings (Bypass for network, Update on reload etc.) by origin, then it would be possible to have them enabled for local development (http://localhost:8080), and disabled for prod and other domains.

There is presumably still an issue that these settings are only in effect while DevTools is open (?); which would mean that even if the settings were always on, unless you remember to toggle open DevTools you will potentially get older cached responses on first load after a change.