Profile
Back to NewsBack
GitHub Trending 2 min
Reader Mode
bundlewatch/bundlewatch: Keep watch of your bundle size

bundlewatch/bundlewatch: Keep watch of your bundle size

19 hours ago

BundleWatch

Keep watch of your bundle size.

Version</a> Monthly Downloads</a> License</a>

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 | – |

License

MIT

Inspired by Siddharth Kshetrapal's bundlesize.

Chat with me