npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

bundlewatch

v1.1.0

Published

Keep watch of your bundle size

Readme

Keep watch of your bundle size.

Version Monthly Downloads License


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.

Inspired by Siddharth Kshetrapal's bundlesize.

Getting started

Requires Node.js 22.17 or later.

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' }],
}

You can also keep your configuration under the bundlewatch key in package.json. See configuration options.

Usage

Run BundleWatch after your build:

npx bundlewatch

It prints the results and exits with code 1 when a file is over its maxSize. Files are measured with gzip by default; Brotli and uncompressed sizes are also supported.

Reporting on pull requests

BundleWatch can report its status on GitHub pull requests and link to a breakdown of the changes:

GitHub Actions

Add a workflow such as .github/workflows/bundlewatch.yml:

name: bundlewatch

on:
  push:
    branches: [main] # the branches you track
  pull_request:

permissions:
  contents: read
  statuses: write

jobs:
  bundlewatch:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: actions/setup-node@v7
        with:
          node-version: 24
      - run: npm ci
      - run: npm run build
      - run: npx bundlewatch
        env:
          BUNDLEWATCH_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

The workflow's token lets BundleWatch post statuses and save baselines. Pushes to main save a baseline; pull requests are compared with the branch they target. Replace main with the branch you track, and see base and tracked branches for other branches.

Pull requests from forks get a read-only token, so BundleWatch cannot post a status on them. Size limits are still checked. See GitHub Actions setup for details.

Other CI providers

Get a token from service.bundlewatch.io/setup-github, store it as the BUNDLEWATCH_GITHUB_TOKEN secret in your CI, and run npx bundlewatch after your build.

BundleWatch detects the repository, commit and branch on supported CI providers. If a value is missing, set CI_REPO_OWNER, CI_REPO_NAME, CI_COMMIT_SHA or CI_BRANCH. When your provider cannot detect the base branch, set CI_BRANCH_BASE to the branch to compare with; otherwise comparisons use master. See supported CI providers and environment variables.

Viewing the results breakdown

Click the status's Details link, or open the results link printed in the build log, to see each file's size, limit and change from the base branch:

Multiple applications in one repository

Requires BundleWatch 1.1.0 or later, for both the CLI and Node API. Use a dependency such as "bundlewatch": "^1.1.0" and ensure CI runs that installed version. Older versions silently ignore prefix and share the unprefixed baseline and bundlewatch GitHub status. Do not downgrade a prefix-enabled application below 1.1.0.

Set prefix: 'storefront' in the storefront frontend's config and prefix: 'admin' in the admin frontend's config. Run BundleWatch from each application's directory. Their statuses become storefront/bundlewatch and admin/bundlewatch, and baselines stay independent even with identical branches and measured paths. Results pages display the prefix.

Prefixes contain 1–64 lowercase ASCII letters, digits, hyphens or underscores and start with a letter or digit. Omit prefix to keep existing names and baselines. Deploy a prefix-capable service to every instance before enabling the option in clients; unsupported services stop prefixed runs without falling back to legacy baselines. See the configuration reference and two-application example.

Node.js API

import bundlewatch, { STATUSES } from 'bundlewatch'

const results = await bundlewatch({
  files: [{ path: './dist/*.js', maxSize: '100kB' }],
})

console.log(results.summary)
if (results.status === STATUSES.FAIL) {
  process.exitCode = 1
}

CommonJS: const bundlewatch = require('bundlewatch').default. TypeScript types are included. See the Node.js API reference.

Features

  • Per-file size limits with glob patterns and gzip, Brotli or no compression.
  • Comparisons with the branch a pull request targets, including branches other than main or master.
  • JavaScript, TypeScript and JSON configuration files, or configuration in package.json.
  • A CLI and Node.js API, with TypeScript types and ES module and CommonJS builds.
  • An open-source service you can host yourself.

Documentation

Contributors

See the contributing guide to get involved.

License

MIT