Add ability to import videos from all supported youtube-dl sites
[oweals/peertube.git] / client / src / main.ts
index f3825fe50cbbbe79226afda1603c1053ec5b71fb..b02b6830f4c1f0f9c722f045b81d02356d076594 100644 (file)
@@ -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()
+}