Keep your library size in check based on bundlesize
minimal setup
npm install bundlesize --save-dev
usage
Add it to your scripts in package.json
"scripts":
Or you can use npx
with NPM 5.2+.
npx bundlesize
configuration
package.json
.
1) Add the path and maxSize in your By default the gzipped size is tested. You can use the compression
option to change this. (gzip
, brotli
, or none
).
bundlesize
also supports glob patterns
Example:
"bundlesize":
You can check for minimum size too.
Example:
"bundlesize":
This makes it great for using with applications that are bundled with another tool. It will match multiple files if necessary and create a new row for each file.
CLI
example usage:
bundlesize -f "dist/*.js" -s 20kBbundlesize -f "dist/*.js" -s 20kB --min-size 15kB
For more granular configuration, we recommend configuring it in the package.json
(documented above).
like it?
⭐️ this repo
TODO
- Work with other CI tools (AppVeyor, etc.)
- Automate setup (setting env_var)
similar projects
- BuildSize - GitHub App, no manual configuration required
- travis-weigh-in - Uses Python rather than Node.js
- size-limit - Uses webpack, builds your files for you.
license
MIT © siddharthkp