Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular AOT using isDevMode giving error

When using isDevMode() working fine for JIT build, while failed for AOT stating

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

trying to create export function like this but no luck

export function isDevModeEnabled() {
   return isDevMode();
}
like image 382
M Hussain Avatar asked Sep 02 '25 10:09

M Hussain


1 Answers

So I also encountered this error, and raised it as an issue here. The official response from the Angular 2 development team is that this is not a bug:

I believe this is an intended behaviour. The solution is to move isDevMode() out of the annotation. (By defining to a variable)

The official solution is:

[...] 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.

like image 175
marked-down Avatar answered Sep 05 '25 00:09

marked-down