react-redux-universal-hot-example
react-redux-universal-hot-example copied to clipboard
Explanation of serviceworker
Can you explain how the serviceworker works and generated in this boilerplate? Thanks.
I just did some digging into this and wanted to share in case it can save anyone some time.
The TLDR is that in webpack/prod.config.js the sw-precache-webpack-plugin is added, and that plugin generates static/dist/service-worker.js. It's purpose without modifying anything is just to precache your site's resources.
The recommended way to extend the generated service worker file is using the importScripts option but you can also modify the template file.