Analyze Rollup, Vite, and Rolldown bundle stats (size, assets, modules, packages) with support for side-by-side comparison between builds. Current stable version is 4.22.1, released under the MIT license. It outputs HTML reports and integrates with RelativeCI for continuous monitoring. Key differentiators include duplicate package detection, cache invalidation metrics, and multi-build comparison. Ships TypeScript types. Requires Node >= 16. Peer dependencies: Rollup ^3 || ^4, Vite ^5 || ^6 || ^7 || ^8, Rolldown ^1.0.0-beta.0. Actively maintained on GitHub with weekly or monthly releases.
npm install rollup-plugin-bundle-statsVerified import paths — ran on the pinned version, not inferred.
Configures Vite plugin to generate HTML bundle stats report with comparison mode, outputting to 'bundle-stats' directory.
Use ES module syntax: `import { bundleStats } from 'rollup-plugin-bundle-stats'`Ensure Rollup ^3 || ^4, Vite ^5 || ^6 || ^7 || ^8
Run with `baseline: true` first to generate baseline JSON, then subsequent runs with `compare: true`
Remove `stats` option; pass options directly to `bundleStats()`
Use dynamic import: `const { bundleStats } = await import('rollup-plugin-bundle-stats')` or switch to ESMUse named import: `import { bundleStats } from 'rollup-plugin-bundle-stats'`Install the package: `npm install --dev rollup-plugin-bundle-stats`