@ngrx/store-devtools for production mode

后端 未结 2 1802
广开言路
广开言路 2021-02-09 10:43

I am using @ngrx/store-devtools instrumentation with the Chrome Extension.

Does it has any sense to disable it for production mode?

2条回答
  •  独厮守ぢ
    2021-02-09 11:39

    You can simply not import it into your NgModule when you are in production mode by doing something like this:

    import { StoreDevtoolsModule } from '@ngrx/store-devtools';
    
    let dev = [
      StoreDevtoolsModule.instrumentOnlyWithExtension()
    ];
    if (environment.production) {
      dev = [];
      enableProdMode();
    }
    
    @NgModule({
      imports: [
        StoreModule.provideStore(rootReducer),
        ...dev
      ]
    })
    export class AppModule {}
    

提交回复
热议问题