/*!
 *
 * Angle - Bootstrap Admin Template
 *
 * Version: 4.0
 * Author: @themicon_co
 * Website: http://themicon.co
 * License: https://wrapbootstrap.com/help/licenses
 *
 */

import './vendor.ts';
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
import { hmrBootstrap } from "./hmr";


if (environment.production) {
    enableProdMode();
}

// let p = platformBrowserDynamic().bootstrapModule(AppModule);
// p.then(() => { (<any>window).appBootstrap && (<any>window).appBootstrap(); })
// .catch(err => console.error(err));

// console.log("main.ts :"+module.id);

const bootstrap = () => {
  return platformBrowserDynamic().bootstrapModule(AppModule);
}

if (environment.hmr) {  
  if (module['hot']) {
    hmrBootstrap(module, bootstrap);
  } else {
    console.error('HMR没有启用，确保 ng server 命令加上 --hmr 标记');
  }
} else {
  bootstrap().then(() => { (<any>window).appBootstrap && (<any>window).appBootstrap(); });
}
