So create-react-app includes service worker functionality by default, which is lovely - all my static assets get cached for offline use out of the box. Cool, but now I want to t
I had the same problem and without doing eject
, I could replace the default service-worker
with workbox
-generated one to add runtime caching webfonts, api calls, etc.
workbox-build
src/sw-template.js
to add your registerRoute
calls/build-sw.js
to copy workbox file to 'build' folder and injectManifest
package.json
scripts to run above build-sw.js
src/registerServiceWorker.js
to replace the default oneYou can find detailed file changes here.