canirequire › ESM-only › rollup-plugin-visualizer
Is rollup-plugin-visualizer ESM-only? Can you require() it?
Visualize and analyze your bundle to quickly see which modules are taking up space.
Last verified Sep 9, 2026 against rollup-plugin-visualizer@7.1.1. Markdown · JSON
ESM-only ESM-only since 7.0.0 — last CommonJS version is 6.0.11
rollup-plugin-visualizer dropped its CommonJS build in 7.0.0 (February 2026). The last version with a plain require()-able CommonJS entry is 6.0.11, published Mar 4, 2026; it declares support for Node.js >=18.
require("rollup-plugin-visualizer") failed in our probe on Node.js 20+ as well; see the runtime table for the error before relying on it. Node.js 18 has no require(esm), and rollup-plugin-visualizer@7.1.1 declares Node.js >=22, so 18 is outside its supported range anyway.
rollup-plugin-visualizer@7.1.1 declares engines ">=22", so Node.js 18, 20 are outside its supported range regardless of module format.
What to do
- require("rollup-plugin-visualizer") failed in our probe on Node.js 20+ as well; see the runtime table for the error before relying on it.
- From a CommonJS file, use a dynamic import inside an async function: const rollupPluginVisualizer = await import("rollup-plugin-visualizer"). That works on every Node.js version the package supports (>=22).
- If you need a synchronous require() or run Node.js 18: npm install rollup-plugin-visualizer@6.0.11, the last CommonJS release (published Mar 4, 2026); it declares Node.js >=18.
- rollup-plugin-visualizer@7.1.1 declares engines ">=22", so Node.js 18, 20 are unsupported regardless: upgrade Node.js or pin an older release.
- TypeScript: types are bundled; install nothing extra.
Does rollup-plugin-visualizer@7.1.1 actually load? Runtime test results
Installed and executed on Sep 9, 2026 with require("rollup-plugin-visualizer") from a CommonJS file and import "rollup-plugin-visualizer" from an ES module.
| Runtime | require("rollup-plugin-visualizer") | import "rollup-plugin-visualizer" |
|---|---|---|
| Node.js 18 | ✗ failsERR_PACKAGE_PATH_NOT_EXPORTED | ✓ works |
| Node.js 20 | ✗ failsERR_PACKAGE_PATH_NOT_EXPORTED | ✓ works |
| Node.js 22 | ✗ failsERR_PACKAGE_PATH_NOT_EXPORTED | ✓ works |
| Node.js 24 | ✗ failsERR_PACKAGE_PATH_NOT_EXPORTED | ✓ works |
| Node.js 26 | ✗ failsERR_PACKAGE_PATH_NOT_EXPORTED | ✓ works |
| Bun 1.4.0 | ✗ failsError | ✓ works |
How to import rollup-plugin-visualizer
ES modules (import)
import * as rollupPluginVisualizer from "rollup-plugin-visualizer";Namespace import shown because the ESM entry may have no default export; use named imports for what it exports.
CommonJS (require)
// require("rollup-plugin-visualizer") failed in our probe on Node.js 22.12+ and newer as well (ERR_PACKAGE_PATH_NOT_EXPORTED); see the runtime table.
// Any Node.js version the package supports (>=22), from an async function:
async function main() {
const rollupPluginVisualizer = await import("rollup-plugin-visualizer");
}
// Or pin the last CommonJS release (declares Node.js >=18):
// npm install rollup-plugin-visualizer@6.0.11Module format by version
Derived from the type, main and exports fields of every stable release on npm, corrected where a runtime test of that version contradicted them (118 versions; the newest 60 shown).
| Versions | Format | First published |
|---|---|---|
| 7.0.0 – 7.1.1 | ESM-only | Feb 20, 2026 |
| 6.0.11 | CommonJS | Mar 4, 2026 |
| 6.0.8 | ESM-only | Feb 19, 2026 |
| 3.3.0 – 6.0.5 | CommonJS | Nov 26, 2019 |
Frequently asked
Is rollup-plugin-visualizer ESM-only?
rollup-plugin-visualizer@7.1.1 is ESM-only. rollup-plugin-visualizer dropped its CommonJS build in 7.0.0 (February 2026). The last version with a plain require()-able CommonJS entry is 6.0.11, published Mar 4, 2026; it declares support for Node.js >=18.
Which version of rollup-plugin-visualizer still supports CommonJS / require()?
6.0.11 is the last version of rollup-plugin-visualizer with a CommonJS build; it declares Node.js >=18. Install it with "npm install rollup-plugin-visualizer@6.0.11". Every version from 7.0.0 on is ESM-only.
How do I use rollup-plugin-visualizer from a CommonJS file?
From a CommonJS file, use a dynamic import inside an async function: const rollupPluginVisualizer = await import("rollup-plugin-visualizer"). That works on every Node.js version the package supports (>=22). require("rollup-plugin-visualizer") failed in our probe on Node.js 20+ as well; see the runtime table for the error before relying on it. Alternatively pin rollup-plugin-visualizer@6.0.11 (declares Node.js >=18).
Does rollup-plugin-visualizer work in Bun?
Yes. import "rollup-plugin-visualizer" loaded successfully in Bun 1.4.0 on Sep 9, 2026.
Does rollup-plugin-visualizer ship TypeScript types?
Yes. rollup-plugin-visualizer bundles its own type declarations; no @types package is needed.
Links
Other esm-only packages
- ansi-styles 7.0.0last CJS
5.2.0 - strip-ansi 7.2.0last CJS
6.0.1 - commander 15.0.0last CJS
14.0.3 - supports-color 11.0.0last CJS
8.1.1 - chalk 6.0.0last CJS
4.1.2 - string-width 8.2.2last CJS
4.2.3 - ansi-regex 6.3.0last CJS
5.0.1 - escape-string-regexp 5.0.0last CJS
4.0.0
Similar popularity
- eslint-plugin-jsdoc 64.3.8ESM-only
- bootstrap 5.3.8CommonJS
- event-stream 4.0.1CommonJS
- webpack-hot-middleware 2.26.1CommonJS
- eslint-config-airbnb-base 15.0.0CommonJS
- canvas 3.2.3CommonJS
- @babel/plugin-proposal-numeric-separator 7.18.6CommonJS
- zone.js 0.16.3CommonJS