diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-09-06 21:48:15 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-09-06 21:48:15 +0200 |
commit | 04de542abd940f9d2ca213fba3c68580c6c9b78a (patch) | |
tree | 13549c2d25883ca6a215536fff319f761d3786bf /client/src/main.browser.ts | |
parent | a8b5de6c670eb19ffbe40726bb60ef1d1dbc10dd (diff) | |
download | PeerTube-04de542abd940f9d2ca213fba3c68580c6c9b78a.tar.gz PeerTube-04de542abd940f9d2ca213fba3c68580c6c9b78a.tar.zst PeerTube-04de542abd940f9d2ca213fba3c68580c6c9b78a.zip |
Update webpack config
Diffstat (limited to 'client/src/main.browser.ts')
-rw-r--r-- | client/src/main.browser.ts | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/client/src/main.browser.ts b/client/src/main.browser.ts index aeae06e04..28f0d5781 100644 --- a/client/src/main.browser.ts +++ b/client/src/main.browser.ts | |||
@@ -1,22 +1,28 @@ | |||
1 | /* tslint: disable */ | 1 | /* tslint: disable */ |
2 | 2 | ||
3 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; | 3 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic' |
4 | import { decorateModuleRef } from './app/environment'; | 4 | import { decorateModuleRef } from './app/environment' |
5 | import { hmrModule } from '@angularclass/hmr' | ||
5 | 6 | ||
6 | /** | 7 | /** |
7 | * App Module | 8 | * App Module |
8 | * our top level module that holds all of our components | 9 | * our top level module that holds all of our components |
9 | */ | 10 | */ |
10 | import { AppModule } from './app'; | 11 | import { AppModule } from './app' |
11 | 12 | ||
12 | /** | 13 | /** |
13 | * Bootstrap our Angular app with a top level NgModule | 14 | * Bootstrap our Angular app with a top level NgModule |
14 | */ | 15 | */ |
15 | export function main(): Promise<any> { | 16 | export function main (): Promise<any> { |
16 | return platformBrowserDynamic() | 17 | return platformBrowserDynamic() |
17 | .bootstrapModule(AppModule) | 18 | .bootstrapModule(AppModule) |
18 | .then(decorateModuleRef) | 19 | .then(decorateModuleRef) |
19 | .catch((err) => console.error(err)); | 20 | .then((ngModuleRef: any) => { |
21 | // `module` global ref for webpackhmr | ||
22 | // Don't run this in Prod | ||
23 | return hmrModule(ngModuleRef, module) | ||
24 | }) | ||
25 | .catch((err) => console.error(err)) | ||
20 | } | 26 | } |
21 | 27 | ||
22 | /** | 28 | /** |
@@ -25,15 +31,15 @@ export function main(): Promise<any> { | |||
25 | */ | 31 | */ |
26 | switch (document.readyState) { | 32 | switch (document.readyState) { |
27 | case 'loading': | 33 | case 'loading': |
28 | document.addEventListener('DOMContentLoaded', _domReadyHandler, false); | 34 | document.addEventListener('DOMContentLoaded', _domReadyHandler, false) |
29 | break; | 35 | break |
30 | case 'interactive': | 36 | case 'interactive': |
31 | case 'complete': | 37 | case 'complete': |
32 | default: | 38 | default: |
33 | main(); | 39 | main() |
34 | } | 40 | } |
35 | 41 | ||
36 | function _domReadyHandler() { | 42 | function _domReadyHandler () { |
37 | document.removeEventListener('DOMContentLoaded', _domReadyHandler, false); | 43 | document.removeEventListener('DOMContentLoaded', _domReadyHandler, false) |
38 | main(); | 44 | main() |
39 | } | 45 | } |