Make HMR work again

This commit is contained in:
SteveSandersonMS
2016-09-19 13:50:26 +01:00
parent a1c1bdb1e6
commit a91b6a6b5c

View File

@@ -1,16 +1,21 @@
import 'angular2-universal-polyfills/browser';
import 'bootstrap';
import './styles/site.css';
import { enableProdMode } from '@angular/core';
import { platformUniversalDynamic } from 'angular2-universal';
import { AppModule } from './app/app.module';
enableProdMode();
platformUniversalDynamic().bootstrapModule(AppModule);
// Include styles in the bundle
import 'bootstrap';
import './styles/site.css';
// Basic hot reloading support. Automatically reloads and restarts the Angular 2 app each time
// you modify source files. This will not preserve any application state other than the URL.
declare var module: any;
if (module.hot) {
module.hot.accept();
// Enable either Hot Module Reloading or production mode
const hotModuleReplacement = module['hot'];
if (hotModuleReplacement) {
hotModuleReplacement.accept();
hotModuleReplacement.dispose(() => { platform.destroy(); });
} else {
enableProdMode();
}
// Boot the application
const platform = platformUniversalDynamic();
platform.bootstrapModule(AppModule);