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-checkVerified import paths — ran on the pinned version, not inferred.
Rollup config using sizeCheck plugin to validate bundle size within +/-5 kB of 95 kB.
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).
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'.Ensure you use the default import: 'import sizeCheck from 'rollup-plugin-filesize-check''.
Provide the 'expect' option with a number in kB: 'sizeCheck({ expect: 100 })'.