Ionic 5/Angular enableProdMode()
In this post we will give you information about Ionic 5/Angular enableProdMode(). Hear we will give you detail about Ionic 5/Angular enableProdMode()And how to use it also give you demo for it if it is necessary.
Ionic 5 supports the latest version of Angular, the popular Google client side framework.
In development phase, Angular works on development mode which has assertions and various necessary framework checks turned on.
After serving your Ionic 5 app using the browser, if you look on the console you are going to find an Angular message telling you that Angular is running on development mode and that you need to enable the production mode using the enableProdMode() function. There is a good reason for this so if you just enable Angular production mode you are going to:
- Have a good boost on performance and speed of your Ionic 5 app: The device ready event will fire much sooner.
- Reduce the app size by half.
How to Enable Angular Production Mode in your Ionic 5 App?
To enable Angular production mode in Ionic 5, we use the enableProdMode() function. Here is a detailed example on how to do it.
First of all, open the src/app/main.ts file.
Next, import enableProdMode from Angular core:
import {enableProdMode} from '@angular/core';import { AppModule } from './app.module';
Next, call the enableProdMode() function before bootstraping your module:
enableProdMode();platformBrowserDynamic().bootstrapModule(AppModule);
Conclusion
So that is all for this short tip tutorial where I just showed you how to enable Angular production mode in Ionic 5 when you are ready to build and publish your mobile app to increase performance and speed, and reduce app size.
Hope this code and post will helped you for implement Ionic 5/Angular enableProdMode(). if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs