DEV Community

Mu Micro
Mu Micro

Posted on

Bundle size creep goes unnoticed until PR review — so I built `buildwatch`

The problem

During development, bundle size creep goes unnoticed — there is no fast way to see that a code change just added 50 KB to your dist folder until it surfaces in a PR review or a production performance regression.

If you've hit this before, you know how it goes — you end up finding out during a PR review, or worse, after a production deploy.

As a solution, I created buildwatch

Watch your build output directory and report file size changes on every rebuild

It's zero-dependency Node.js, so you can run it immediately without installing anything:

npx buildwatch ./dist
Enter fullscreen mode Exit fullscreen mode

Output:

buildwatch v1.0.0
Watching /projects/myapp/dist
Initial state: 3 files, 1.0 MB total

[10:23:41] 2 files changed

  main.js          136.4 KB  +12.1 KB (+9.7%)
  main.css           8.3 KB  +0.1 KB (+1.2%)
  vendor.js        892.1 KB  no change

  Total: 1,036.8 KB  +12.2 KB (+1.2%)
Enter fullscreen mode Exit fullscreen mode

How it works

Pure Node.js using fs.watch() for directory monitoring and fs.stat() for file sizes, with 300ms debouncing to handle rapid build events, printing ANSI-colored per-file and total size deltas.

Why I built it

Found repeated complaints in r/webdev and r/node about not noticing bundle size regressions until PR review or production. Existing tools like bundlesize and size-limit require CI config changes or build plugin integration. No popular zero-dep tool gives you instant terminal feedback during local development — a file watcher that just runs alongside your dev server fills this gap cleanly.

Try it

npx buildwatch --help
Enter fullscreen mode Exit fullscreen mode

Part of µ micro — one new developer tool, shipped every day. All tools are zero-dependency Node.js and run instantly with npx.

Top comments (0)