Exclusive Clothing Sale On Flipkart

Get up to 50% off on our latest collection.

Shop Now

Error/Warning :- Initial exceeded maximum budget in angular

 

Initial exceeded the maximum budget in Angular 

As applications grow in functionality, they also grow in size. The CLI lets you set the size 

thresholds in your configuration to ensure that parts of your application stay within the size boundaries that you define.

While deploying my Angular application in production, I build the project with the command --prod.

ng build --prod

And I got an error message:

Error: budgets: initial exceeded maximum budget. 
Budget Budget 2 MB was exceeded by 1.77 MB.

Solution

We can describe our Angular application as a set of compiled JavaScript files called bundles
 which are generated by the build process. Angular budgets allow us to configure the expected sizes of these bundles. We can configure thresholds for conditions when we want to notify as a warning or fail to build with an error if the bundle size gets exceeds that limit.

To set the budget custom limit, open angular.json file and find the budget keyword.

It should look like this:

         1 "budgets": [
2{
3"type": "initial",
4"maximumWarning": "2mb",
5"maximumError": "5mb"
6}
7]
C#
   
You can increase the maximumWarning value to prevent the warning, or maximumError 

value to change the limit for the failed error message, i.e.:

         1 "budgets": [
2{
3"type": "initial",
4"maximumWarning": "4mb",
5"maximumError": "6mb"
6}
7]
C#
References:





---------------------------------------------------------

Share this

Related Posts

Previous
Next Post »

Exclusive Clothing Sale On Flipkart

Get up to 50% off on our latest collection.

Shop Now