Create-react-app v2 uses the workbox cacheFirst strategy. I want to use staleWhileRevalidate. How can I create a custom service worker and add it too a exising app?
Create-react-app v2 uses the workbox cacheFirst strategy. I want to use staleWhileRevalidate. How can I create a custom service worker and add it too a exising app?
Please update to create-react-app v4 if you'd like more control over your service worker.
You can start a new project that will use a service worker that you can make changes to using:
npx create-react-app my-app --template cra-template-pwa
There are details in the current documentation.