If your Angular Application bundle size exceed certain limit, you might get WARNING in budgets, maximum exceeded for initial
error.
As Angular applications grow in functionality, they also grow in size.
Angular CLI gives us the ability to set size thresholds in the configuration file i.e., angular.json
file, so that our application size stay within the defined boundaries.
We can define your size boundaries in the CLI configuration file, angular.json
, in a budgets
section for each configured environment. i.e., production,stage and development environments etc..
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
}
]
},
}
So to fix Angular WARNING in budgets, maximum exceeded for initial
error follow the below steps
- Open
angular.json
and check forbudgets
keyword. - And increase the
maximumWarning
andmaximumError
values inkb
ormb
.
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "5mb",
"maximumError": "10mb"
}
]
},
}
This should solve your issue.