OKTA_CONFIG variable

Hello dear people;

I deploying an Angular app but show this error when compiling the app in production mode; in development mode everthing is fine; may someone of you can support me to fix this issue?

ERROR in src\app\app-routing.module.ts: Error during template compile of ‘AppRoutingModule’
Only initialized variables and constants can be referenced in decorators because the value of this variable is needed by the template compiler in ‘OKTA_CONFIG’
‘OKTA_CONFIG’ references ‘OKTA_CONFIG’
‘OKTA_CONFIG’ is not initialized at @okta\okta-angular\dist\src\okta\models\okta.config.ts.

Thanks in advanced.

I have spent hours on this as well. I was sure I was doing something wrong, so in the end I just cloned the okta/samples-js-angular repo from GitHub and I get exactly the behavior described above.

If in angular.json you change the “production” build configuration from
“production”: {
“optimization”: true,
…,
“aot”: true,
“buildOptimizer”: true,
…,
}

To:
“production”: {
“optimization”: true,
…,
“aot”: false,
“buildOptimizer”: false,
…,
}

At least you can build it. But, this is no solution

Let me check :slight_smile:
Thanks for the reply.

Stumbled upon this question while trying to update to Angular9 using @okta/okta-angular.

The problem was indeed a compatibility issue with AOT compilation and has been fixed in version @okta/okta-angular@1.3.1.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.