Limiting the application bundle size
As developers, we always want to build impressive applications that contain cool features for the end user. As such, we end up adding more and more features to our Angular app – sometimes according to the specifications and at other times to provide additional value to users. However, adding new functionality in an Angular app will cause it to grow in size, which may not be acceptable at some point. To overcome this problem, we can use Angular CLI budgets for our production build.
Budgets are thresholds that we can define in the angular.json
configuration file and make sure that the size of our application does not exceed those thresholds. To set budgets, we can use the budgets
property of the production
configuration in the build
environment:
"budgets":Â [ Â Â { Â Â Â Â "type":Â "initial", Â Â Â Â "maximumWarning":Â "2mb", Â &...