app/src/main.ts

30 lines
808 B
TypeScript
Raw Normal View History

2018-08-14 12:26:23 +00:00
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
2018-10-02 08:54:45 +00:00
import * as Path from 'path';
2018-08-14 12:26:23 +00:00
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
import { hmrBootstrap } from './hmr';
if (environment.production) {
enableProdMode();
}
// platformBrowserDynamic().bootstrapModule(AppModule)
// .catch(err => console.log(err));
const bootstrap = () => platformBrowserDynamic().bootstrapModule(AppModule);
if (environment.hmr) {
2018-10-02 08:54:45 +00:00
if (module['hot']) {
2018-08-14 12:26:23 +00:00
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().catch(err => console.log(err));
}