Angular5 Service Worker update(SWUpdate) not detecting on firefox. Working on chrome Angular5 Service Worker update(SWUpdate) not detecting on firefox. Working on chrome angular angular

Angular5 Service Worker update(SWUpdate) not detecting on firefox. Working on chrome


I had this same issue and was able to fix it by registering the service worker in main.ts:

platformBrowserDynamic().bootstrapModule(AppModule).then(() => {  if ('serviceWorker' in navigator && environment.production) {    navigator.serviceWorker.register('/ngsw-worker.js');  }}).catch(err => console.log(err));

I also created a Service worker service to notify the user when there is a new update available:

enter image description here

If you are interested in how my service worker service looks, you can see the code here.

You can also check if any errors have been logged by visiting yourdomain.com/ngsw/state