create-react-scripts-workbox
Repalce old sw-precache-webpack-plugin Plugin to workbox-webpack-plugin.
It also allow you to add serviceWorker.js
to extend the service-worker.js
generated in webpack build.
Like what importScripts
did in sw-precache-webpack-plugin
.
Example Usage:
Modify crs.config
Modify crs.config
as below.
const compose = moduleexports = ;
Customize service-worker (Optional)
Please make sure you read the follwing issues. (https://github.com/GoogleChrome/workbox/issues/672) (https://github.com/GoogleChrome/workbox/issues/795)
Create serviceWorker.js
under your application folder
; const workboxSW = clientsClaim: true; // This array will be populated by workboxBuild.injectManifest() when the// production service worker is generated.workboxSW; workboxSWrouter;