cra-replace-service-worker

Replaces Create React App's service worker with you own service worker without ejecting. This package also adds a variable 'PRECACHE_FILES' to your custom service worker. It contains a list of file-paths to all CRA files generated inside the 'build'-folde

Usage no npm install needed!

<script type="module">
  import craReplaceServiceWorker from 'https://cdn.skypack.dev/cra-replace-service-worker';
</script>

README

This package replaces Create React App's service worker with you own service worker without ejecting. This package also adds a variable 'PRECACHE_FILES' to your custom service worker. It contains a list of file-paths to all CRA files generated inside the 'build'-folder.

Usage

In your package.json under scripts add the following:

"replace-sw": "cra-replace-service-worker ./src/your-custom-sw.js"

Enjoy!