ReferenceError: IDBIndex is not defined in angular universal app

后端 未结 2 407
别跟我提以往
别跟我提以往 2021-01-15 19:42

I was running the application using \"ng serve\" it was working fine. But after I built the app using \"npm run build:ssr\", The app got built successfully.

After bu

2条回答
  •  失恋的感觉
    2021-01-15 20:41

    if you still want to use the angulare/fire/performance module, in your app.module.ts, you could do this.

    import { isPlatformBrowser } from '@angular/common';
    import { AppComponent } from './app.component';
    
    const importModuleArray: any[] = [ // your modules here ]
    
    if (isPlatformBrowser) {
      require('@angular/fire/performance').then(module => {
        importModuleArray.push(module.AngularFirePerformanceModule);
      });}
    
    @NgModule({
      **your declarated modules as AppComponent for example**
      ],
      imports: importModuleArray
      bootstrap: [AppComponent]
    })
    

提交回复
热议问题