]>
Commit | Line | Data |
---|---|---|
361dcebc | 1 | import { enableProdMode } from '@angular/core' |
b6827820 | 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic' |
63c4db6d | 3 | |
b6827820 C |
4 | import { AppModule } from './app/app.module' |
5 | import { environment } from './environments/environment' | |
63c4db6d C |
6 | |
7 | if (environment.production) { | |
b6827820 | 8 | enableProdMode() |
63c4db6d C |
9 | } |
10 | ||
77d07d69 | 11 | const bootstrap = () => platformBrowserDynamic() |
361dcebc | 12 | .bootstrapModule(AppModule) |
78967fca | 13 | .then(bootstrapModule => { |
fed95155 | 14 | // TODO: Uncomment and remove unregistration when https://github.com/angular/angular/issues/21191 is fixed |
78967fca | 15 | // TODO: Remove when https://github.com/angular/angular-cli/issues/8779 is fixed? |
fed95155 C |
16 | // if ('serviceWorker' in navigator && environment.production) { |
17 | // navigator.serviceWorker.register('/ngsw-worker.js') | |
18 | // .catch(err => console.error('Cannot register service worker.', err)) | |
19 | // } | |
20 | ||
c7ca4c8b | 21 | if (navigator.serviceWorker && typeof navigator.serviceWorker.getRegistrations === 'function') { |
73e09f27 | 22 | navigator.serviceWorker.getRegistrations() |
361dcebc C |
23 | .then(registrations => { |
24 | for (const registration of registrations) { | |
25 | registration.unregister() | |
26 | } | |
27 | }) | |
73e09f27 | 28 | } |
78967fca C |
29 | |
30 | return bootstrapModule | |
31 | }) | |
32 | .catch(err => { | |
33 | console.error(err) | |
34 | return null | |
35 | }) | |
77d07d69 | 36 | |
4f926722 | 37 | bootstrap() |