command-line tool

bundle-cost
know the cost before you commit it

Print the raw, gzip, and brotli size of your build output — and the delta on every save.

$ bundle-cost dist/index.js --watch

File             Raw      Gzip
dist/index.js  9.89 KB  3.37 KB
total          9.89 KB  3.37 KB
watching for changes… (ctrl-c to stop)

# …you add a date library and hit save

File              Raw      Gzip   Δ gzip
dist/index.js  24.1 KB  9.02 KB  +5.65 KB
total          24.1 KB  9.02 KB  +5.65 KB

# …you swap it for a 1-line helper and hit save

File              Raw      Gzip   Δ gzip
dist/index.js  10.1 KB  3.44 KB  -5.58 KB
total          10.1 KB  3.44 KB  -5.58 KB

Real transfer bytes

gzip and brotli via Node's own zlib — the size a CDN actually serves, not an estimate.

Delta on every save

Watch mode diffs against your last save, so regressions show up in green and red instantly.

Budgets for CI

--limit 50kb exits non-zero when you blow the budget. Fail the build, not the user.

Zero ceremony

No bundler plugin, no config, no telemetry. One dependency. JSON output when you need it.

Install

# from GitHub (always works)
pnpm add -g github:kea0811/bundle-cost-cli

# or run it once, no install
pnpm dlx bundle-cost-cli dist/index.js