Parse and compare build size
Install locally with npm:
$ npm install --save-dev build-size
Install globally with npm:
$ npm install --global build-size
Locally with npm:
# Display help
$ npm run build-size -- --help
# Parse
$ npm run build-size -- parse ./previous/**/*.js ./previous/**/*.css > previous.json
$ npm run build-size -- parse ./new/**/*.js ./new/**/*.css > new.json
# Compare
$ npm run build-size -- compare previous.json new.json
Globally:
# Display help
$ build-size --help
# Parse
$ build-size parse ./previous/**/*.js ./previous/**/*.css > previous.json
$ build-size parse ./new/**/*.js ./new/**/*.css > new.json
# Compare
$ build-size compare previous.json new.json
Parse:
$ build-size parse js/*.js css/*.css
{
"js/app.js": 133104,
"js/manifest.js": 1478,
"js/vendor.js": 466292,
"css/app.css": 24491
}
Compare:
$ build-size compare previous.json new.json
This change will increase the build size from 610.71 KB to 616.04 KB, an increase of 5.33 KB \(1%\)
File name | Previous size | New size | Change
--- | --- | --- | ---
js\/app.js | 129.98 KB | 135.32 KB |  5.33 KB \(4%\)
js\/manifest.js | 1.44 KB | 1.45 KB |  2 B \(0%\)
js\/vendor.js | 455.36 KB | 455.36 KB | 0 B \(0%\)
css\/app.css | 23.92 KB | 23.92 KB | 0 B \(0%\)
$ npm test
Please see CONTRIBUTING and CODE_OF_CONDUCT for details.
If you discover any security related issues, please email security@swis.nl instead of using the issue tracker.
Inspired by BuildSize and similar projects, such as bundlesize and Size Limit.
The MIT License (MIT). Please see License File for more information.
This package is Treeware. If you use it in production, then we ask that you buy the world a tree to thank us for our work. By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.
SWIS is a web agency from Leiden, the Netherlands. We love working with open source software.