> ## Documentation Index
> Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Bundle Analyzer

> Purpose: Inspect production chunk contents and sizes to validate code-splitting and guide further optimizations.

**Purpose:** Inspect production chunk contents and sizes to validate code-splitting and guide further optimizations.

## How to run

```bash theme={null}
npm run build:analyze
```

This runs a full production build with `rollup-plugin-visualizer` enabled and writes a report to **`dist/stats.html`**.

## How to view

1. After the build completes, open `dist/stats.html` in a browser (e.g. drag the file into a browser window, or use a local server from the project root).
2. Use the report’s **Treemap**, **Sunburst**, or **Network** views to see which modules belong to which chunks and their sizes.

## When to use

* After changing chunking (e.g. `vite.config.ts` `manualChunks`, lazy imports) to confirm vendor and route chunks.
* When investigating large chunks (e.g. >500 KB) to see what’s included.
* Before considering route-group or other advanced splitting (Phase 5 of the chunking strategy).

## Notes

* `dist/` is gitignored; the report is local only.
* The analyzer runs only when `ANALYZE=true` is set (via `npm run build:analyze`). Normal `npm run build` does not generate the report.
