A Rollup plugin that analyzes bundle composition by showing sizes and percentages for each module and its constituent files. Current stable version 1.1.0 (2024) supports Rollup 2, 3, and 4, and is compatible with Vite. It helps identify bloated libraries by printing a hierarchical breakdown of output chunks, optionally with per-file details. Differentiators: lightweight (only 4 dependencies), simple reporter API, and dual ESM/CJS support. Released under MIT license.
npm install rollup-plugin-sizesVerified import paths — ran on the pinned version, not inferred.
Shows how to add the plugin to a Rollup config, enabling per-file breakdown.
Place sizes() after all other plugins in the plugins array.
Use rollup-plugin-sizes@1.0.0 or later with Rollup >=2.
Ensure the build completes successfully before expecting output.
Set details: false (default) to see only top-level module sizes.
Run 'npm install rollup-plugin-sizes --save-dev'.
Use 'import sizes from 'rollup-plugin-sizes'' instead of '{ sizes }'.Move sizes() to the end of the plugins array.
Use 'sizes({ details: true })' with parentheses.