@ ngrx/store-devtools用于生产模式 [英] @ngrx/store-devtools for production mode

查看:83
本文介绍了@ ngrx/store-devtools用于生产模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过Chrome扩展程序使用 @ ngrx/store-devtools 工具.

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

在生产模式下禁用它是否有意义?

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

推荐答案

在生产模式下,您不能通过以下操作简单地将其导入到NgModule中:

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 {}

这篇关于@ ngrx/store-devtools用于生产模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆