rollup-plugin-bundle-size
raw JSON → 1.0.3 verified Mon Apr 27 auth: no javascript
A Rollup plugin that displays the size of the generated bundle(s) after build. v1.0.3 (last release). It provides a simple, no-frills way to see bundle size in the console output. Unlike more comprehensive tools like rollup-plugin-visualizer, it focuses solely on size reporting without additional analysis. Works with Rollup's plugin system. No recent updates; considered stable but minimal.
Common errors
error Error: Cannot find module 'rollup-plugin-bundle-size' ↓
cause Missing or incorrect npm install
fix
Run 'npm install --save-dev rollup-plugin-bundle-size'
error TypeError: bundleSize is not a function ↓
cause Incorrect import of named export instead of default
fix
Use 'import bundleSize from 'rollup-plugin-bundle-size'' or 'const bundleSize = require('rollup-plugin-bundle-size')'
Warnings
deprecated Plugin may be unmaintained; no updates since 2019. ↓
fix Consider using rollup-plugin-visualizer or rollup-plugin-filesize for active maintenance and more features.
gotcha The plugin only shows size for the first output bundle; does not report multiple outputs. ↓
fix Use a workaround or switch to an alternative if you have multiple output targets.
gotcha Output format may not reflect tree-shaken size accurately for ESM outputs. ↓
fix Verify size with actual bundle inspection or use a more detailed analyzer.
Install
npm install rollup-plugin-bundle-size yarn add rollup-plugin-bundle-size pnpm add rollup-plugin-bundle-size Imports
- bundleSize wrong
const bundleSize = require('rollup-plugin-bundle-size')correctimport bundleSize from 'rollup-plugin-bundle-size' - bundleSize wrong
import { bundleSize } from 'rollup-plugin-bundle-size'correctconst bundleSize = require('rollup-plugin-bundle-size') - bundleSize wrong
import bundleSize from 'rollup-plugin-bundle-size/bundle-size'correctimport bundleSize from 'rollup-plugin-bundle-size'
Quickstart
import bundleSize from 'rollup-plugin-bundle-size';
export default {
input: 'src/index.js',
output: { file: 'dist/bundle.js', format: 'cjs' },
plugins: [bundleSize()]
};