Angular AOT 使用 isDevMode 给出错误
Angular AOT using isDevMode giving error
当使用 isDevMode() 时,JIT 构建工作正常,而 AOT 声明失败
Error: Error encountered resolving symbol values statically. Calling function 'isDevMode', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function
尝试创建这样的导出函数,但没有成功
export function isDevModeEnabled() {
return isDevMode();
}
一个疯狂的猜测,但也许你可以尝试使函数 public
而不是任何东西 - 它在我尝试 AOT 编译时帮助我 problems 。
所以我也遇到了这个错误,并提出了一个问题here。 Angular2开发组的官方回应是这不是bug:
I believe this is an intended behaviour. The solution is to move isDevMode() out of the annotation. (By defining to a variable)
官方的解决方案是:
[...] You will need to set the return value to a variable, and use the variable rather than calling the function when wiring up the NgModule.
当使用 isDevMode() 时,JIT 构建工作正常,而 AOT 声明失败
Error: Error encountered resolving symbol values statically. Calling function 'isDevMode', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function
尝试创建这样的导出函数,但没有成功
export function isDevModeEnabled() {
return isDevMode();
}
一个疯狂的猜测,但也许你可以尝试使函数 public
而不是任何东西 - 它在我尝试 AOT 编译时帮助我 problems 。
所以我也遇到了这个错误,并提出了一个问题here。 Angular2开发组的官方回应是这不是bug:
I believe this is an intended behaviour. The solution is to move isDevMode() out of the annotation. (By defining to a variable)
官方的解决方案是:
[...] You will need to set the return value to a variable, and use the variable rather than calling the function when wiring up the NgModule.