1 import { enableProdMode } from '@angular/core'
2 import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'
4 import { AppModule } from './app/app.module'
5 import { environment } from './environments/environment'
7 if (environment.production) {
11 const bootstrap = () => platformBrowserDynamic()
12 .bootstrapModule(AppModule)
13 .then(bootstrapModule => {
14 // TODO: Uncomment and remove unregistration when https://github.com/angular/angular/issues/21191 is fixed
15 // TODO: Remove when https://github.com/angular/angular-cli/issues/8779 is fixed?
16 // if ('serviceWorker' in navigator && environment.production) {
17 // navigator.serviceWorker.register('/ngsw-worker.js')
18 // .catch(err => console.error('Cannot register service worker.', err))
21 if (navigator.serviceWorker && typeof navigator.serviceWorker.getRegistrations === 'function') {
22 navigator.serviceWorker.getRegistrations()
23 .then(registrations => {
24 for (const registration of registrations) {
25 registration.unregister()
30 return bootstrapModule