【问题标题】:pass isDevMode to forRoot throw error in Prod env在 Prod env 中将 isDevMode 传递给 forRoot 抛出错误
【发布时间】:2018-06-26 10:50:41
【问题描述】:

如下代码

const isDev = isDevMode()
const modules = [
    HttpClientModule,
    NgxsModule.forRoot(AllStates, { developmentMode: isDev }),
]

此代码在开发环境中运行良好,但在生产环境中会引发错误。 错误是Error during template compile of 'CoreModule' Function calls are not supported in decorators but 'isDevMode' was called.

有没有办法将 isDevMode 传递给 forRoot 函数? 谢谢

【问题讨论】:

    标签: javascript angular angular-cli


    【解决方案1】:

    最后,我使用了const isDev = !environment.production,并且运行良好。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-12-10
      • 1970-01-01
      • 2022-01-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多