-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathmain.ts
36 lines (33 loc) · 1.03 KB
/
main.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { enableProdMode, ViewEncapsulation } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from 'app/app.module';
import { environment } from '@env/environment';
import { preloaderFinished } from '@delon/theme';
preloaderFinished();
import { hmrBootstrap } from 'hmr';
if (environment.production) {
enableProdMode();
}
const bootstrap = () => {
return platformBrowserDynamic()
.bootstrapModule(AppModule, {
defaultEncapsulation: ViewEncapsulation.Emulated,
preserveWhitespaces: false,
})
.then(res => {
if ((<any>window).appBootstrap) {
(<any>window).appBootstrap();
}
return res;
});
};
if (environment.hmr) {
if (module['hot']) {
hmrBootstrap(module, bootstrap);
} else {
console.error('HMR is not enabled for webpack-dev-server!');
console.log('Are you using the --hmr flag for ng serve?');
}
} else {
bootstrap();
}