Registry / devops / rollup-plugin-filesize

rollup-plugin-filesize

JSON →
library10.0.0jsnpmunverified

A Rollup plugin that displays the size of output files in the CLI, including minified, gzipped, and Brotli sizes. Version 10.0.0 is the latest stable, requiring Node >=16 and Rollup >=4 (ESM-only). It offers customizable output formatting, a reporter API for custom handlers (e.g., badge generation), and experimental size comparisons against previous releases or builds. Differentiates from alternative size plugins with built-in Brotli support and theme-aware display.

npm install rollup-plugin-filesize
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-FILE
R
rollup-plugin-filesize
devopsjavascriptv10.0.0
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
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 18–223 runs
build_error
glibc
node 18–223 runs
build_error
Code
Verified usage

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

filesize
✓ import filesize from 'rollup-plugin-filesize';
✗ const filesize = require('rollup-plugin-filesize');
Package is ESM-only since v10; CommonJS require will fail.
filesize
✓ import { filesize } from 'rollup-plugin-filesize';
✗ import filesize from 'rollup-plugin-filesize';
Named export available for tree-shaking; both work but named is preferred.
Plugin
✓ import type { Plugin } from 'rollup';
✗ import { Plugin } from 'rollup-plugin-filesize';
Plugin type is from Rollup, not from this package.

Shows how to integrate the plugin into a Rollup build, displaying minified and gzipped sizes.

import { rollup } from 'rollup'; import filesize from 'rollup-plugin-filesize'; async function build() { const bundle = await rollup({ input: 'src/index.js', plugins: [ filesize({ showMinifiedSize: true, showGzippedSize: true, showBrotliSize: false, theme: 'dark' }) ] }); await bundle.write({ file: 'dist/bundle.js', format: 'es' }); } build().catch(err => console.error(err));
Debug
Known issues
breakingVersion 10 drops CommonJS support; package is ESM-only.
fix
Use import syntax and ensure Node >=16.
affects: >=10.0.0
breakingVersion 6 drops terser for minification; minification is optional.
fix
If minification is needed, use a separate plugin like @rollup/plugin-terser.
affects: >=6.0.0
deprecatedThe 'render' function option is deprecated; use 'reporter' instead.
fix
Replace 'render' with 'reporter' option.
affects: >=5.0.0
gotchaFor code-splitting builds, the plugin reports each file individually.
fix
Check console output for per-file sizes; aggregate manually if needed.
affects: >=6.1.0
gotchaWindows compatibility fixed in v8.0.1 for import paths.
fix
Use v8.0.1 or later on Windows.
affects: >=8.0.1
deprecatedshowBeforeSizes is experimental and may change.
fix
Do not rely on it for production use.
affects: *
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module not supported
Package is ESM-only; CommonJS require fails.
fix
Use import syntax instead of require().
TypeError: filesize is not a function
Default import used but named import does not match.
fix
Use import filesize from 'rollup-plugin-filesize'.
Error: Cannot find module 'rollup-plugin-filesize'
Package not installed or incorrect path.
fix
Run npm install rollup-plugin-filesize --save-dev.
Upgrade
Version history
10.0.0latest on npm
Audit
Dependencies
rolluprequiredpeer dependency; plugin is designed for Rollup
Agent activity
6 hits · last 30 days
node
4
Resources
rollup-plugin-filesize — npm install rollup-plugin-filesize · libregistry