whatisgithub

What is size-limit?

ai/size-limit — explained in plain English

Analysis updated 2026-06-24

6,906JavaScriptAudience · developerComplexity · 2/5Setup · easy

In one sentence

Size Limit measures your JavaScript bundle's real compressed download size and execution time, then blocks deploys or pull requests if it grows past a threshold you set.

Mindmap

mindmap
  root((size-limit))
    What it does
      Track bundle size
      Block oversized PRs
      Measure exec time
    How it works
      webpack bundling
      Real compression
      Headless browser
    CI integration
      GitHub Actions
      CircleCI
      PR comments
    Modes
      Web apps
      Large libraries
      Small libraries
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Add a size check to pull requests so the team is warned before merging a dependency that bloats the bundle.

USE CASE 2

Measure how long your JavaScript library actually takes to execute on a slow mobile device, not just its file size.

USE CASE 3

Get a GitHub PR comment on every merge showing exactly how much the bundle size changed and why.

USE CASE 4

Enforce a size budget on a JavaScript library to keep it lightweight for all downstream users.

What is it built with?

JavaScriptNode.jswebpacknpmGitHub Actions

How does it compare?

ai/size-limitveltman/flubbersindresorhus/query-string
Stars6,9066,9076,903
LanguageJavaScriptJavaScriptJavaScript
Setup difficultyeasyeasyeasy
Complexity2/52/52/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 30min

So what is it?

Size Limit is a tool that tracks how large your JavaScript code gets and stops your project from shipping if it crosses a threshold you set. You add it to your build process, define a size limit in kilobytes or as a time budget, and it will check each new commit or pull request against that limit. If someone adds a large dependency that pushes the bundle over the line, the check fails and the team knows before it reaches users. The tool does not just count the raw bytes of your files. It bundles your code using webpack, includes all dependencies and any browser compatibility code that gets added automatically, then compresses the result the same way a web server would. This gives a realistic picture of what a user actually downloads, not just what the source files weigh. There is also a time-based mode that runs a headless browser and measures how long the browser takes to download, parse, and execute the JavaScript on a slow device. This is useful because JavaScript takes much longer to process than the same number of kilobytes in an image. Setup involves installing one or two packages from npm and adding a small configuration block to your package.json. You specify which files to measure and what the limit is. The tool then integrates with GitHub Actions, CircleCI, or any other continuous integration system. There is a GitHub Action that posts a comment on each pull request showing exactly how much the bundle size changed. The tool supports three modes: one for complete web applications that bundle their own code, one for large JavaScript libraries, and one for small libraries with many individual files. You pick the mode that matches your project. A --why flag produces a detailed breakdown showing which dependencies are responsible for the most size. Well-known projects including PostCSS, MobX, nanoid, and Ant Design have used Size Limit to reduce their published sizes by 20 to 90 percent.

Copy-paste prompts

Prompt 1
Add size-limit to my React app's package.json so that any PR adding more than 10KB to the bundle fails the CI check.
Prompt 2
Set up size-limit in GitHub Actions to post a comment on every pull request showing how much the bundle size changed.
Prompt 3
Use size-limit's --why flag to find out which npm dependency is responsible for the biggest chunk of my bundle.
Prompt 4
Configure size-limit for a small utility library with multiple entry points and set individual size limits per export.

Frequently asked questions

What is size-limit?

Size Limit measures your JavaScript bundle's real compressed download size and execution time, then blocks deploys or pull requests if it grows past a threshold you set.

What language is size-limit written in?

Mainly JavaScript. The stack also includes JavaScript, Node.js, webpack.

How hard is size-limit to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is size-limit for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.