1 import { ApplicationRef, enableProdMode } from '@angular/core'
2 import { enableDebugTools } from '@angular/platform-browser'
3 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 if ('serviceWorker' in navigator && environment.production) {
15 navigator.serviceWorker.register('/ngsw-worker.js')
16 .catch(err => console.error('Cannot register service worker.', err))
19 if (!environment.production) {
20 const applicationRef = bootstrapModule.injector.get(ApplicationRef)
21 const componentRef = applicationRef.components[0]
23 // allows to run `ng.profiler.timeChangeDetection();`
24 enableDebugTools(componentRef)
27 return bootstrapModule