I've an app that I already had built and SW were working fine. I continue to develop without paying attention to SW ... And now, there is no more SW getting download while charging the app (as if the app was not registring the SW).
I'm pretty desesperate as I have no idea on how to debug/found clue on that issue. How can I track the SW registring process ?
More context:
"serviceWorker": true
in .angular-cli.jsonServiceWorkerModule.register('/ngsw-worker.js', { enabled: environment.production })
in my app.module.tsServiceWorkerModule.register('/ngsw-worker.js', { enabled: environment.production })
first, second after BrowserModule and last)environment.production
was true
(it is)Can i check something else? Did I forget something?
If not my two last solutions are:
It appears that the problem is caused by angularFire2
. I had the same issue but was able to fix it by putting the following code in my main.ts
file.
if ('serviceWorker' in navigator && environment.production) {
navigator.serviceWorker.register('/ngsw-worker.js');
}
a also had to change my base url to index.html, otherwise the service worker can not work by design:
index.html:
<base href="index.html">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With