X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=client%2Fsrc%2Fmain.ts;h=b02b6830f4c1f0f9c722f045b81d02356d076594;hb=61b3e146e16e997ea539cd4610af10d4b681e04a;hp=f3825fe50cbbbe79226afda1603c1053ec5b71fb;hpb=b682782093a22a729eea8862476ff1c8aac4ef0c;p=oweals%2Fpeertube.git 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' import { AppModule } from './app/app.module' import { environment } from './environments/environment' +import { hmrBootstrap } from './hmr' + if (environment.production) { enableProdMode() } -platformBrowserDynamic() +const bootstrap = () => platformBrowserDynamic() .bootstrapModule(AppModule) - .catch(err => console.log(err)) + +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() +}