skipWaiting in a Service Worker with react-scripts v3
06/12/2019 — 1 Min Read — In Development
A recent update to workbox broke the skip waiting functionality in a service worker generated by CRAv3.
I'm using cra-append-sw to patch the service worker generated by react-scripts.
All that I needed to do was change workbox.skipWaiting();
to workbox.core.skipWaiting();
to get it working again.
The new workbox-window
package was helpful in testing this behavior, setting a reload to fire on install, etc. This article was helpful in setting it up: https://medium.com/@webmaxru/workbox-4-implementing-refresh-to-update-version-flow-using-the-workbox-window-module-41284967e79c