]>
Commit | Line | Data |
---|---|---|
1 | import { enableProdMode } from '@angular/core' | |
2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic' | |
3 | ||
4 | import { AppModule } from './app/app.module' | |
5 | import { environment } from './environments/environment' | |
6 | ||
7 | if (environment.production) { | |
8 | enableProdMode() | |
9 | } | |
10 | ||
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)) | |
19 | // } | |
20 | ||
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() | |
26 | } | |
27 | }) | |
28 | } | |
29 | ||
30 | return bootstrapModule | |
31 | }) | |
32 | .catch(err => { | |
33 | console.error(err) | |
34 | return null | |
35 | }) | |
36 | ||
37 | bootstrap() |