/composable-react-pwa-template

A templated custome service worker for your react apps created by "create-react-app"

Primary LanguageJavaScriptApache License 2.0Apache-2.0

Custom Workbox Service Worker for React Apps

A templated custom service worker for your react apps created with "create-react-app"

Setting up

  • Create a new empty js file, sw.js in the public folder.

  • Copy the code snippet in this folder to it.

  • Replace the code snippet in serviceWorker.js with the code snippet in the new serviceWorker.js here

Build your React PWA

  • On running npm build, sw.js will be copied into the build folder with the new custom Workbox config for cache strategies.

  • Use this this VS Code Extension to easily get the Workbox Code Snippets for use in your Workbox Service Workers.

  • Learn more about Workbox here.

Enjoy!