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.
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,
…,
}