BundleWatch checks file sizes so bundled browser assets don't suddenly grow. A sharp increase usually means something went wrong: a package that bloats the bundle, an incorrect import, or a missing minification step.
On pull requests, it compares each file with the target branch and reports the result as a GitHub status.
Getting started
npm install --save-dev bundlewatch
Create bundlewatch.config.mjs in your project root:
/* @type {import('bundlewatch').BundlewatchConfig} /
export default {
files: [{ path: './dist/*.js', maxSize: '100kB' }],
}
Run npx bundlewatch after your build.
To report results on pull requests, see GitHub Actions setup. The documentation also covers other CI providers, configuration options, the Node.js API and migrating from 0.x.
Repository layout
| Path | What it is | Ships as |
| ---------------------------------------------------- | -------------------------------------------------------------------------- | ----------------------------------------------------------------- |
| packages/bundlewatch | The CLI and Node.js API | bundlewatch on npm |
| packages/core | Analysis, results links and GitHub statuses, shared by the CLI and service | Bundled into both; not published |
| packages/service | Stores baselines and renders results pages | service.bundlewatch.io on AWS Lambda |
| packages/website | The documentation site | bundlewatch.io on AWS Amplify, with pull request previews |
| packages/contract-tests | Runs bundlewatch 0.4.2 and the current CLI side by side | – |
- CONTRACT.md lists the behavior that must stay compatible with 0.x CLIs, services and links.
- MIGRATION.md lists what changed in 1.0.
- CONTRIBUTING.md explains how to work on the repository.
License
Inspired by Siddharth Kshetrapal's bundlesize.