Registry / devops / rollup-plugin-filesize-check

rollup-plugin-filesize-check

JSON →
library1.2.0jsnpmunverified

A tiny Rollup plugin that validates that the output bundle size is within an expected range. Currently at version 1.2.0, it offers a simple API: provide an expected size (in kB) and a tolerance (warn) in kB. The plugin warns or errors if the actual size deviates beyond the tolerance. Unlike more feature-rich alternatives like rollup-plugin-filesize or rollup-plugin-sizes, this package focuses purely on size checking with minimal configuration and no visual reporting. It has stable, low release cadence, and is intended for developers who want CI-style size enforcement in their Rollup builds.

npm install rollup-plugin-filesize-check
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-FILE
R
rollup-plugin-filesize-check
devopsjavascriptv1.2.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

sizeCheck
import sizeCheck from 'rollup-plugin-filesize-check'
const sizeCheck = require('rollup-plugin-filesize-check')
Package ships as ESM; default import is the recommended way. CommonJS require may not work without transpilation.

Rollup config using sizeCheck plugin to validate bundle size within +/-5 kB of 95 kB.

// install: npm i rollup-plugin-filesize-check --save-dev import sizeCheck from 'rollup-plugin-filesize-check'; export default { input: 'src/index.js', output: [{ file: 'builds/out.js', format: 'umd' }], plugins: [ sizeCheck({ expect: 95, // expected size in kB warn: 5 // acceptable deviation in kB }) ] };
Debug
Known issues
gotchaThe 'warn' option has a misleading name; it sets a tolerance threshold, not a warning level. If the actual size deviates by more than this value, the plugin prints a warning (red text) but does not fail the build.
fix
Set 'warn' to the maximum acceptable difference in kB. To fail the build, you need to handle this outside the plugin (e.g., custom check or CI).
affects: <=1.2.0
Errors
Common errors & fixes
Error: Cannot find module 'rollup-plugin-filesize-check'
Package not installed or ESM/CJS mismatch. The package is ESM-only and must be imported with 'import', not 'require'.
fix
Run 'npm install rollup-plugin-filesize-check --save-dev'. Use 'import sizeCheck from 'rollup-plugin-filesize-check'' in your Rollup config. If using CommonJS, consider dynamic import: 'const sizeCheck = (await import('rollup-plugin-filesize-check')).default'.
TypeError: sizeCheck is not a function
CommonJS require() of an ESM module, or using wrong import syntax (e.g., named import instead of default).
fix
Ensure you use the default import: 'import sizeCheck from 'rollup-plugin-filesize-check''.
Plugin failed: rollup-plugin-filesize-check: expect option is required
Missing 'expect' option in plugin invocation, or it's undefined/null.
fix
Provide the 'expect' option with a number in kB: 'sizeCheck({ expect: 100 })'.
Upgrade
Version history
1.2.0latest on npm
Audit
Dependencies
rolluprequiredPeer dependency; the plugin requires Rollup to function as a build tool.
Agent activity
8 hits · last 30 days
node
6
Resources
rollup-plugin-filesize-check — npm install rollup-plugin-filesize-check · libregistry