# Share an esbuild Metafile — Bundle Analysis as a Link

Canonical: https://commareports.com/share-esbuild-metafile
Published: 2026-09-15

> esbuild's metafile is JSON until you render it. Build a treemap with esbuild-visualizer or Bundle Buddy, publish it to Comma, and the size regression becomes reviewable.

# Share an esbuild metafile

esbuild will tell you exactly why your bundle is 400 KB heavier than last
week — the metafile has every input, every output and the import chain that
connects them. It just hands you JSON, and JSON is not an argument anyone
wants to read during a pull request review.

## Build the treemap

```bash
esbuild src/index.ts --bundle --minify \
  --outfile=dist/bundle.js --metafile=meta.json

npx esbuild-visualizer --metadata meta.json --filename stats.html
```

`stats.html` is standalone: the treemap, the sunburst toggle and the search
box all travel inside the file.

## Publish it

Drag `stats.html` into [the app](https://commareports.com/), or from CI:

```bash
curl -fsS -X PATCH "https://commareports.com/api/v1/reports/$REPORT_ID" \
  -H "Authorization: Bearer $COMMA_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d "$(jq -n --rawfile html stats.html \
        --arg title "Bundle — $GITHUB_REF_NAME" '{title: $title, html: $html}')"
```

Scripts run inside a sandboxed iframe (`allow-scripts`, no
`allow-same-origin`), so the treemap stays interactive at the URL — you can
zoom into a chunk rather than squinting at a screenshot of one.

## Size is a delta, not a number

"Bundle is 812 KB" means nothing on its own. "Bundle is 812 KB, up 106 KB
since Tuesday, and the new weight is all in `vendor-charts`" is a review
comment.

PATCH one report id per entry point and the revision history does that
bookkeeping for you:

- **Revisions** per build, so the previous treemap is one click away.
- **Anchored threads** on the chunk that grew — "this is the whole icon set;
  we only use six" — next to the box that shows it. See
  [commenting on HTML](/comment-on-html).
- **One id per branch** if you want per-PR previews rather than a main-line
  trend.

## Limits

- **Entry HTML: 5 MB.** Assets: 25 MB per file, 250 MB and 500 files total.
  A metafile for a very large app can push the rendered page toward the entry
  cap — visualize one entry point at a time.
- **60 requests/minute per token.**

## Try it

Comma is free — unlimited reports, unlimited commenters, unlimited revision
history.

**[Publish a bundle report →](https://commareports.com/)**

### Related

- [Share a bundle analyzer report](/share-bundle-analyzer-report) · [Share a Rollup visualizer report](/share-rollup-visualizer-report)
- [Share a source-map-explorer report](/share-source-map-explorer-report) · [Share a Statoscope report](/share-statoscope-report)
- [Share a Vite build](/share-vite-build) · [Share a Lighthouse report](/share-lighthouse-report)
