fix(service-worker): fixes service worker issue in init-service-worke… (#3378)

This commit is contained in:
Pavan Kumar Jadda 2023-05-09 17:10:09 -04:00 committed by GitHub
parent 0b4c3649e7
commit 55f996cf48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,7 +3,12 @@
// modules, so it's perfectly fine to serve this code to any browsers // modules, so it's perfectly fine to serve this code to any browsers
// (older browsers will just ignore it) // (older browsers will just ignore it)
// //
import { Workbox } from 'https://storage.googleapis.com/workbox-cdn/releases/5.0.0-beta.1/workbox-window.prod.mjs'; //import { Workbox } from './workbox-window.prod.mjs';
// proper initialization
if( 'function' === typeof importScripts) {
importScripts(
'https://storage.googleapis.com/workbox-cdn/releases/6.5.4/workbox-window.prod.mjs'
);
var supportsServiceWorker = 'serviceWorker' in navigator; var supportsServiceWorker = 'serviceWorker' in navigator;
var isNotLocalDevelopment = var isNotLocalDevelopment =
@ -50,3 +55,5 @@ if (supportsServiceWorker && isNotLocalDevelopment) {
wb.register(); wb.register();
} }
}