# Size Limit

> Linter for your JavaScript application that makes the Web lighter by preventing JS library bloat.

- URL: https://evilmartians.com/opensource/size-limit
- GitHub: https://github.com/ai/size-limit
- Authors: Andrey Sitnik

---

Size Limit makes the Web lighter by preventing JavaScript library bloat. This linter for your JavaScript application or library performance calculates the real cost of your JavaScript for end-users and throws an error if the cost exceeds the limit.

Size Limit is a "performance budgeting tool" for JavaScript. It checks every commit on CI, calculates the real cost of your JS for end-users, and throws an error if the cost exceeds the limit.

*Read also Evil Martians' article*: https://evilmartians.com/chronicles/size-limit-make-the-web-lighter

* **ES modules** and **tree-shaking** support.
* Add Size Limit to **Circle CI**, **GitHub Actions**, or another CI system to know if a pull request adds a massive dependency.
* **Modular** to fit different use cases: big JS applications that use their own bundler or small npm libraries with many files.
* Can calculate **the time** it would take a browser to download and **execute** your JS. Time is a much more accurate and understandable metric compared to the size in bytes.
* Calculations include **all dependencies and polyfills** used in your JS.

*Image: Size Limit CLI*

With `--why`, Size Limit can tell you *why* your library is of this size and show the real cost of all your internal dependencies. We use [Statoscope] for this analysis.

*Image: Statoscope example*

[GitHub action]: https://github.com/andresz1/size-limit-action
[Statoscope]:    https://github.com/statoscope/statoscope

## Who Uses Size Limit

* [MobX](https://github.com/mobxjs/mobx)
* [Material-UI](https://github.com/callemall/material-ui)
* [Autoprefixer](https://github.com/postcss/autoprefixer)
* [PostCSS](https://github.com/postcss/postcss) reduced [25% of the size](https://github.com/postcss/postcss/commit/150edaa42f6d7ede73d8c72be9909f0a0f87a70f).
* [Browserslist](https://github.com/browserslist/browserslist) reduced [25% of the size](https://github.com/browserslist/browserslist/commit/640b62fa83a20897cae75298a9f2715642531623).
* [EmojiMart](https://github.com/missive/emoji-mart) reduced [20% of the size](https://github.com/missive/emoji-mart/pull/111)
* [nanoid](https://github.com/ai/nanoid) reduced [33% of the size](https://github.com/ai/nanoid/commit/036612e7d6cc5760313a8850a2751a5e95184eab).
* [React Focus Lock](https://github.com/theKashey/react-focus-lock) reduced [32% of the size](https://github.com/theKashey/react-focus-lock/pull/48).
* [Logux](https://github.com/logux) reduced [90% of the size](https://github.com/logux/logux-client/commit/62b258e20e1818b23ae39b9c4cd49e2495781e91).
