Differences between dev and prod builds

I think I wrote about this before. Yesterday I was making the final changes for a PWA app with Ionic4… until that time, I tested my app using ionic serve or ionic build. Then, I decided to use ionic build --prod… and the compiler started to complain about a LOT of things that it had never complained before!! And the worst is that it was RIGHT about complaining about those things (like referencing a private member inside the page’s html).

My question is: what is the logic about having a different set of restrictions/validations when building for dev and when building for production??? If my app builds ok in dev IT ALSO SHOULD BUILD OK in production mode, shouldn’t it ?

The prod build process is too long to be usefull in a dev workflow

The additional checks are to avoid runtime issues

Some can be tweaked in tsconfig as they dictate the rigor in eg typescript compliance

Some should be avoided be teaching yourself discipline to code differently from the start even though it may seem more work

By the way, this is all angular related stuff notnionic

I understand. Nevertheless, is confusing. Thanks for the clarification.

U r free to deploy with ionic build with no prod flag

Just make sure u keep your eyes wide shut when launching to your users :grinning::grinning::grinning:

Veras colega esto me sucedio a mi hace unos 16 meses, y tuve que solucionar cada uno de los errores por los que se quejaba el compilador, entonces posterior a esto decidí utilizar la bandera –aot cada vez que estoy desarrollando en ionic o angular, eso permite que al nomas tener un error te lo muestra para cuando compiles en producción no tengas que regresar a solucionar errores, y asi vas aprendiendo sobre los errores que estas cometiendo al momento de estar desarrollando.

Saludos espero te ayude esto.

1 Like

Si, aprendizajes muy duros si no haces como mencionas

Well, maybe I had it coming anyway. I am still an absolute newbie to Ionic, Angular and TypeScript :slight_smile:

1 Like