X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fmain.ts;h=b02b6830f4c1f0f9c722f045b81d02356d076594;hb=24a8e782d8b2adb208d9cfb8659450395e2e2a77;hp=76b3f498a7343fef556bbe22149660ffd8918d18;hpb=4a6995be18b15de1834a39c8921a0e4109671bb6;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/main.ts b/client/src/main.ts index 76b3f498a..b02b6830f 100644 --- a/client/src/main.ts +++ b/client/src/main.ts @@ -1,10 +1,25 @@ -import { enableProdMode } from '@angular/core'; -import { bootstrap } from '@angular/platform-browser-dynamic'; +import { enableProdMode } from '@angular/core' +import { platformBrowserDynamic } from '@angular/platform-browser-dynamic' -import { AppComponent } from './app/app.component'; +import { AppModule } from './app/app.module' +import { environment } from './environments/environment' -if (process.env.ENV === 'production') { - enableProdMode(); +import { hmrBootstrap } from './hmr' + +if (environment.production) { + enableProdMode() } -bootstrap(AppComponent); +const bootstrap = () => platformBrowserDynamic() + .bootstrapModule(AppModule) + +if (environment.hmr) { + if (module[ 'hot' ]) { + hmrBootstrap(module, bootstrap) + } else { + console.error('HMR is not enabled for webpack-dev-server!') + console.log('Are you using the --hmr flag for ng serve?') + } +} else { + bootstrap() +}