Why did angular service worker isn't registered

1.8k views Asked by At

I have added angular2 pwa to my project but when I try to build and start it with prod build for some reason service worker isn't working. Configuration seems to be proper, I've added and registered it in the main module with: ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production }). But when I start app service worker isn't running. If someone had similar issues???

1

There are 1 answers

0
svyat1s On BEST ANSWER

Just try to add registration strategy to your configuration:

ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production, registrationStrategy: 'registerImmediately' })