在开发过程中,我们通常使用进口:
import { NgxsReduxDevtoolsPluginModule } from '@ngxs/devtools-plugin';
import { NgxsLoggerPluginModule } from '@ngxs/logger-plugin';是否应该在生产构建中删除这些内容,或者是否有利于在生产构建中保持这些内容的完整(排除生产问题的疑难解答.?)
发布于 2018-07-30 13:52:16
我将在这个答复中为你总结我的意见:
您通常在prod env中删除这样的插件。它只消耗内存,不为客户提供福利。您可以将它们保存在QA和DEV中,至少,我就是这样做的。
下面是我如何在构建中处理它:
// Module
// example with ngrx, but it works the same with ngxs
@NgModule({
declarations: [AppComponent],
imports: [
...,
environment.devToolsEnabled
? StoreDevtoolsModule.instrument({
maxAge: 50
})
: []
],
providers: [...],
bootstrap: [AppComponent]
})
export class AppModule {
constructor() {}
}
// environment
export const environment = {
production: false,
devToolsEnabled: true,
...
};在构建时,environment.ts文件将被特定的环境文件覆盖,该标记如下:
ng build --configuration=<<environment>>
https://stackoverflow.com/questions/51585700
复制相似问题