Fix service worker updates

This commit is contained in:
Stefano Brilli 2020-03-24 10:02:08 +01:00
parent 4f9ec8b6a4
commit 270f38ab25
3 changed files with 19 additions and 2 deletions

View File

@ -34,7 +34,7 @@
"homepage": "https://stefano.brilli.me/webminidisc/",
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"build": "react-scripts build && cat public/extra-service-worker.js build/service-worker.js > build/final-service-worker.js",
"test": "react-scripts test",
"eject": "react-scripts eject",
"predeploy": "npm run build",

View File

@ -0,0 +1,17 @@
// List of extra files to be precached for offline use.
// WARNING: don't forget to update the revision before deploy
var revision = "6";
self.__precacheManifest = (self.__precacheManifest || []).concat([
{
"revision": revision,
"url": "/webminidisc/atracdenc.js"
},
{
"revision": revision,
"url": "/webminidisc/worker.min.js"
},
{
"revision": revision,
"url": "/webminidisc/ffmpeg-core.js"
},
]);

View File

@ -35,7 +35,7 @@ export function register(config?: Config) {
}
window.addEventListener('load', () => {
const swUrl = `${process.env.PUBLIC_URL}/custom-service-worker.js`;
const swUrl = `${process.env.PUBLIC_URL}/final-service-worker.js`;
if (isLocalhost) {
// This is running on localhost. Let's check if a service worker still exists or not.