react-snap icon indicating copy to clipboard operation
react-snap copied to clipboard

sw-precache is deprecated

Open Cooya opened this issue 4 years ago • 0 comments

As sw-precache is now deprecated, I would suggest to update the doc here with workbox-cli. For instance :

package.json

"scripts": {
    "build-snap": "react-scripts build && react-snap && workbox generateSW scripts/workbox-config.js
}

scripts/workbox-config.js

module.exports = {
	globDirectory: 'build/',
	globPatterns: ['**/*.{html,json,js,css,txt}'],
	swDest: 'build/service-worker.js',
	sourcemap: false
};

I knew nothing about both of them and I had to spend some time to understand how to generate a custom service worker for SSR. I think it would be great to show this already figured out configuration in the doc for other beginners like me :blush:

Cooya avatar Jul 14 '20 16:07 Cooya