{"id":22025,"library":"rollup-plugin-filesize-check","title":"rollup-plugin-filesize-check","description":"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.","status":"active","version":"1.2.0","language":"javascript","source_language":"en","source_url":"https://github.com/spencermountain/rollup-plugin-filesize-check","tags":["javascript","rollup","filesize"],"install":[{"cmd":"npm install rollup-plugin-filesize-check","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-filesize-check","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-filesize-check","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; the plugin requires Rollup to function as a build tool.","package":"rollup","optional":false}],"imports":[{"note":"Package ships as ESM; default import is the recommended way. CommonJS require may not work without transpilation.","wrong":"const sizeCheck = require('rollup-plugin-filesize-check')","symbol":"sizeCheck","correct":"import sizeCheck from 'rollup-plugin-filesize-check'"}],"quickstart":{"code":"// install: npm i rollup-plugin-filesize-check --save-dev\n\nimport sizeCheck from 'rollup-plugin-filesize-check';\n\nexport default {\n  input: 'src/index.js',\n  output: [{ file: 'builds/out.js', format: 'umd' }],\n  plugins: [\n    sizeCheck({\n      expect: 95, // expected size in kB\n      warn: 5     // acceptable deviation in kB\n    })\n  ]\n};","lang":"javascript","description":"Rollup config using sizeCheck plugin to validate bundle size within +/-5 kB of 95 kB."},"warnings":[{"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).","message":"The '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.","severity":"gotcha","affected_versions":"<=1.2.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"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'.","cause":"Package not installed or ESM/CJS mismatch. The package is ESM-only and must be imported with 'import', not 'require'.","error":"Error: Cannot find module 'rollup-plugin-filesize-check'"},{"fix":"Ensure you use the default import: 'import sizeCheck from 'rollup-plugin-filesize-check''.","cause":"CommonJS require() of an ESM module, or using wrong import syntax (e.g., named import instead of default).","error":"TypeError: sizeCheck is not a function"},{"fix":"Provide the 'expect' option with a number in kB: 'sizeCheck({ expect: 100 })'.","cause":"Missing 'expect' option in plugin invocation, or it's undefined/null.","error":"Plugin failed: rollup-plugin-filesize-check: expect option is required"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}