# Angular build: Error: bundle initial exceeded maximum budget. Budget 1.00 MB was not met by 120.00 kB with a total of 1.12 MB

**Code:** `exceeded maximum budget` · **Category:** Angular · **Seen on:** Angular, Angular CLI

The production build is larger than the size limits (budgets) in angular.json, and the build is configured to fail.

## Meaning

Angular's budgets guard bundle size: `initial`, `anyComponentStyle`, `anyScript` and others. When a limit is crossed as an error, `ng build` fails. Fix by shrinking the bundle (lazy loading, removing unused libraries, importing only what you need) or deliberately adjusting the budget if growth is justified.

## Common causes

- Heavy library added to the initial bundle (moment, lodash, charts)
- Features not lazy-loaded
- Component styles larger than the `anyComponentStyle` limit
- Source maps or dev-only code included
- Budgets set too low for the current app

## Quick fix

1. Analyse the bundle: `ng build --stats-json` + a bundle analyzer
2. Lazy load routes (`loadChildren` / `loadComponent`) and large libraries
3. Raise the budget in angular.json if growth is intentional

## Detailed fix by platform

### Angular CLI

1. `ng build --stats-json` then `npx webpack-bundle-analyzer dist/<app>/stats.json` (webpack) or `npx esbuild-visualizer` for the esbuild builder
2. Replace `moment` with `date-fns`/Temporal, import single functions

## Code examples

### angular.json budgets

```json
"budgets": [
  { "type": "initial", "maximumWarning": "1mb", "maximumError": "1.5mb" },
  { "type": "anyComponentStyle", "maximumWarning": "6kb", "maximumError": "12kb" }
]
```

## How to diagnose

1. **Budget** — Which type and size (initial or a style)?
2. **Cause** — What grew since the last green build?
3. **Fix** — Can it be lazy loaded or removed?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/angular/budget-exceeded-bundle-initial)
