@rbarriuso wrote:
Hi all,
We found an issue: depending on if compiling with
ionic cordova build
orionic cordova build --prod --release
, a ternary conditional operator considers the condition flag to be alwaystrue
, being that flag an static member of a Typescript class.For example:
File
app.config.ts
:export class AppConfig { public static readonly IS_COMPONENT_FLAG = false; }
File
app.module.ts
:@NgModule({ imports: [ ... IonicModule.forRoot(AppConfig.IS_COMPONENT_FLAG ? AppComponentTrue : AppComponentFalse) ], ... }) export class AppModule { }
When the previous code is run with
ionic serve
orionic cordova run
, theAppComponentTrue
component is displayed. Nevertheless when run withionic cordova run --prod --release
, theAppComponentFalse
component is displayed.In this S.O. question there’s a simple project you can download to reproduce it.
Does anybody have an explanation for this? Is it an Ionic / Angular AOT compiler bug?
Thanks in advance.
Posts: 1
Participants: 1