1.2.4 • Published 6 years ago
bundle-range v1.2.4
minimal setup
npm install bundlesize --save-dev
usage
Add it to your scripts in package.json
"scripts": {
"test": "bundlesize"
}
Or you can use npx with NPM 5.2+.
npx bundlesizeconfiguration
1) Add the path and maxSize in your package.json.
By default the gzipped size is tested. You can use the compression option to change this. (gzip, brotli, or none).
{
"name": "your cool library",
"version": "1.1.2",
"bundlesize": [
{
"path": "./dist.js",
"maxSize": "30 kB",
"minSize": "3 kB"
}
]
}bundlesize also supports glob patterns
Example:
"bundlesize": [
{
"path": "./dist/vendor-*.js",
"maxSize": "30 kB",
"minSize": "3 kB",
},
{
"path": "./dist/chunk-*.js",
"maxSize": "20 kB",
"minSize": "2 kB",
}
]You can check for minimum size too.
Example:
"bundlesize": [
{
"path": "./dist.js",
"maxSize": "100 kB",
"minSize": "2 kB"
},
{
"path": [
"./src/compressed-size.js",
"./src/files.js",
"./index.js"
],
"minSize": "1B",
"maxSize": "1MB",
"compression": "none"
}
]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 20kB
bundlesize -f "dist/*.js" -s 20kB --min-size 15kBFor more granular configuration, we recommend configuring it in the package.json (documented above).
like it?
:star: 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