Registry / devops / rollup-plugin-size

rollup-plugin-size

JSON →
library0.3.1jsnpmunverified

Prints gzipped sizes of Rollup bundle assets and tracks changes since last build. Version 0.3.1 is the latest release, with low maintenance. It is a port of Google Chrome Labs' size-plugin for Webpack, providing per-file size comparison and historical tracking via a stored .size-snapshot.json file. Key differentiator: integrates directly into Rollup's output lifecycle.

npm install rollup-plugin-size
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-SIZE
R
rollup-plugin-size
devopsjavascriptv0.3.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
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 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

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

size
import size from 'rollup-plugin-size'
const { size } = require('rollup-plugin-size')
Default export is a function. Named export does not exist.
Plugin (type)
import type { Plugin } from 'rollup'; import size from 'rollup-plugin-size'
import { Plugin } from 'rollup-plugin-size'
The package does not export TypeScript types. Use Rollup's Plugin type for annotation.

Basic Rollup configuration using rollup-plugin-size to print gzipped sizes of output files.

import size from 'rollup-plugin-size'; export default { input: 'src/main.js', output: { dir: 'dist', format: 'esm' }, plugins: [size()] };
Debug
Known issues
breakingThe plugin writes a .size-snapshot.json file in the current directory by default, which may conflict with version control or CI processes.
fix
Set the 'filename' option to a custom path or add .size-snapshot.json to .gitignore.
affects: >=0.1.0
deprecatedThe 'profile' option has been removed in recent versions.
fix
Remove the 'profile' option from plugin configuration.
affects: >=0.2.0
gotchaThe plugin requires the 'rollup' peer dependency to be installed. It will not work without Rollup being present in the project.
fix
Install Rollup via `npm install --save-dev rollup`.
affects: >=0.1.0
gotchaChanges tracking is based on a file system snapshot; if the snapshot is deleted or not committed across environments, comparisons will be incomplete.
fix
Commit the .size-snapshot.json file to version control if you want persistent change tracking across builds.
affects: >=0.1.0
Errors
Common errors & fixes
TypeError: size is not a function
Using a named import `{ size }` instead of default import.
fix
Use `import size from 'rollup-plugin-size'` (default import).
Error: Cannot find module 'rollup-plugin-size'
Package not installed or missing from node_modules.
fix
Run `npm install --save-dev rollup-plugin-size`.
Upgrade
Version history
0.3.1latest on npm
Audit
Dependencies
rolluprequiredpeer dependency (peerDep in package.json)
Agent activity
24 hits · last 30 days
node
20
OpenAI (training)
2
Amazon
1
Resources
rollup-plugin-size — npm install rollup-plugin-size · libregistry