javascript - 在 Prod env 中将 isDevMode 传递给 forRoot 抛出错误
问题描述
代码如下
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 函数?谢谢
解决方案
最后,我使用const isDev = !environment.production
,并且工作良好。
推荐阅读
- bash - 检查 bash 脚本是否已经运行,除了它本身带有参数
- firebase - 我们如何在 Firestore 的数组中创建一个数组?
- windows - 使用 Powershell 创建 Windows 集群
- ios - Fastlane gym failed 退出状态:1 虽然存档成功
- python - 得到一个圆圈内的所有点
- android - 此 NavController 未知导航目的地
- java - 在测试用例中为返回 void 的 API 服务添加断言语句?
- .net - 在静态类中定义扩展方法的原因?
- frontend - 如何决定前端使用哪个框架?
- java - 在springboot上使用elasticsearch查询