Skip to content

Commit a91b6a6

Browse files
Make HMR work again
1 parent a1c1bdb commit a91b6a6

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed
Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
import 'angular2-universal-polyfills/browser';
2-
import 'bootstrap';
3-
import './styles/site.css';
42
import { enableProdMode } from '@angular/core';
53
import { platformUniversalDynamic } from 'angular2-universal';
64
import { AppModule } from './app/app.module';
75

8-
enableProdMode();
9-
platformUniversalDynamic().bootstrapModule(AppModule);
6+
// Include styles in the bundle
7+
import 'bootstrap';
8+
import './styles/site.css';
109

11-
// Basic hot reloading support. Automatically reloads and restarts the Angular 2 app each time
12-
// you modify source files. This will not preserve any application state other than the URL.
13-
declare var module: any;
14-
if (module.hot) {
15-
module.hot.accept();
10+
// Enable either Hot Module Reloading or production mode
11+
const hotModuleReplacement = module['hot'];
12+
if (hotModuleReplacement) {
13+
hotModuleReplacement.accept();
14+
hotModuleReplacement.dispose(() => { platform.destroy(); });
15+
} else {
16+
enableProdMode();
1617
}
18+
19+
// Boot the application
20+
const platform = platformUniversalDynamic();
21+
platform.bootstrapModule(AppModule);

0 commit comments

Comments
 (0)