bundlesize is a build tool that enforces bundle size limits on your JavaScript artifacts.
The tool solves the problem of unintended bundle bloat by allowing you to specify maximum size thresholds for your build outputs and failing the build if those thresholds are exceeded. It works by accepting a configuration of files to monitor, compressing them (gzip by default), and comparing their sizes against your defined limits. The tool supports fuzzy glob patterns to match files with unpredictable names like those with content hashes, making it compatible with build systems like create-react-app and Next.js.
bundlesize suits projects where bundle size matters to performance and you want automated enforcement in your CI pipeline. It integrates with GitHub pull requests to display size check results directly on commits when used with Travis CI, CircleCI, Wercker, or Drone. The tool offers flexibility in compression methods, allowing you to specify brotli compression per file or disable compression entirely if needed. Configuration lives in package.json or a separate bundlesize.config.json file, keeping setup minimal.
The project maintains active engagement with its issue tracker and pull requests, responding to user questions and reviewing contributions. Development includes regular updates to dependencies and bug fixes addressing edge cases in file matching and CI integration. The tool receives ongoing maintenance to support new CI platforms and compression standards as they emerge.