esbuild bundle size tracking with the metafile you already have
esbuild's speed makes it easy to run a production build on every commit, but speed alone does not tell you whether the output is getting larger. The --metafile flag gives you a precise, machine-readable record of every input file, its size, and how it maps to each output chunk — enough to attribute every byte to its source module. That metafile is what dendrobundle reads. You are already paying the cost of the build; the only addition is storing the metafile somewhere it can be compared against previous commits.
Set it up for esbuild
Pass --metafile=stats.json to the esbuild CLI (or set metafile: true in the JavaScript API). esbuild writes a JSON file that maps input modules to output chunks with their byte sizes. That file is what you POST to dendrobundle.
# 1. build with the metafile
npx esbuild src/index.ts --bundle --outfile=dist/bundle.js --metafile=stats.json
# 2. submit the snapshot
curl -sS "https://dendrobundle.com/api/push?branch=$(git branch --show-current)&commit=$(git rev-parse HEAD)" \
-H "Authorization: Bearer $DENDROBUNDLE_TOKEN" \
-H "Content-Type: application/json" \
-d @stats.jsonFull details on the supported formats and CI integration pages.
esbuild bundle tracking — FAQ
- Does the metafile work when esbuild is used via Vite, tsup, or tsx?
- When esbuild is invoked directly via its CLI or JS API, you control whether --metafile is set. When it is invoked internally by another tool (Vite, tsup), you typically do not have direct access to the metafile — in those cases the host tool’s own stats format (rollup-plugin-visualizer for Vite) is the better path. dendrobundle’s esbuild format is for direct esbuild invocations.
- My build has dozens of entry points. Does dendrobundle handle that?
- Yes. The metafile records every output file and its contributing inputs regardless of entry-point count. dendrobundle creates an asset record for each output file and attributes modules to the chunk they landed in, so the treemap reflects that structure.
- How big is the metafile, and does that affect ingest speed?
- Metafile size scales with the number of input modules, not output size. A few hundred modules might produce a few hundred KB; thousands could produce several MB. dendrobundle parses and stores the data server-side — the POST is fast over a CI connection and the file is not stored verbatim.
- We use esbuild for a browser bundle and a Node.js server build. Can we track both?
- Create two dendrobundle projects — one for the browser output, one for the server output — and POST each metafile to its token. Each gets its own history, budget, and alerts, which is the right model given browser and server bundles differ meaningfully.
Track your esbuild output from the next build — free tier, no card, three projects included — or upload a metafile at dendrobundle.com/analyze to see the module breakdown immediately.
create a free account