diff options
author | Chocobozzz <me@florianbigard.com> | 2017-12-12 14:45:42 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2017-12-12 14:45:42 +0100 |
commit | 77d07d690968a9631fc0c8bafbaebd27a5ebaab6 (patch) | |
tree | d513fdc81ed82b60edaa0b683f5f8d8dc9fc9db3 /client/src/main.ts | |
parent | b2731bff2834fb6aacf166cf435030bf96eb12f3 (diff) | |
download | PeerTube-77d07d690968a9631fc0c8bafbaebd27a5ebaab6.tar.gz PeerTube-77d07d690968a9631fc0c8bafbaebd27a5ebaab6.tar.zst PeerTube-77d07d690968a9631fc0c8bafbaebd27a5ebaab6.zip |
Add hmr
Diffstat (limited to 'client/src/main.ts')
-rw-r--r-- | client/src/main.ts | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/client/src/main.ts b/client/src/main.ts index f3825fe50..b02b6830f 100644 --- a/client/src/main.ts +++ b/client/src/main.ts | |||
@@ -4,10 +4,22 @@ import { platformBrowserDynamic } from '@angular/platform-browser-dynamic' | |||
4 | import { AppModule } from './app/app.module' | 4 | import { AppModule } from './app/app.module' |
5 | import { environment } from './environments/environment' | 5 | import { environment } from './environments/environment' |
6 | 6 | ||
7 | import { hmrBootstrap } from './hmr' | ||
8 | |||
7 | if (environment.production) { | 9 | if (environment.production) { |
8 | enableProdMode() | 10 | enableProdMode() |
9 | } | 11 | } |
10 | 12 | ||
11 | platformBrowserDynamic() | 13 | const bootstrap = () => platformBrowserDynamic() |
12 | .bootstrapModule(AppModule) | 14 | .bootstrapModule(AppModule) |
13 | .catch(err => console.log(err)) | 15 | |
16 | if (environment.hmr) { | ||
17 | if (module[ 'hot' ]) { | ||
18 | hmrBootstrap(module, bootstrap) | ||
19 | } else { | ||
20 | console.error('HMR is not enabled for webpack-dev-server!') | ||
21 | console.log('Are you using the --hmr flag for ng serve?') | ||
22 | } | ||
23 | } else { | ||
24 | bootstrap() | ||
25 | } | ||