]>
Commit | Line | Data |
---|---|---|
68f6c87a C |
1 | import { ApplicationRef, enableProdMode } from '@angular/core' |
2 | import { enableDebugTools } from '@angular/platform-browser' | |
b6827820 | 3 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic' |
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 => { |
dfdd158a | 14 | if ('serviceWorker' in navigator && environment.production) { |
15 | navigator.serviceWorker.register('/ngsw-worker.js') | |
16 | .catch(err => console.error('Cannot register service worker.', err)) | |
73e09f27 | 17 | } |
78967fca | 18 | |
68f6c87a C |
19 | if (!environment.production) { |
20 | const applicationRef = bootstrapModule.injector.get(ApplicationRef) | |
21 | const componentRef = applicationRef.components[0] | |
22 | ||
23 | // allows to run `ng.profiler.timeChangeDetection();` | |
24 | enableDebugTools(componentRef) | |
25 | } | |
26 | ||
78967fca C |
27 | return bootstrapModule |
28 | }) | |
29 | .catch(err => { | |
30 | console.error(err) | |
31 | return null | |
32 | }) | |
77d07d69 | 33 | |
4f926722 | 34 | bootstrap() |