canirequire

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

  1. 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.
  2. 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).
  3. 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.
  4. 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.
  5. TypeScript: types are bundled; install nothing extra.
Latest
7.1.1 (Aug 14, 2026)
Module format
ESM-only
Last CommonJS version
6.0.11
ESM-only since
7.0.0 (Feb 20, 2026)
TypeScript types
Bundled
Node engines
>=22
Weekly downloads
5.5M
License
MIT

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.

Runtimerequire("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.11

Module 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).

VersionsFormatFirst published
7.0.0 – 7.1.1ESM-onlyFeb 20, 2026
6.0.11CommonJSMar 4, 2026
6.0.8ESM-onlyFeb 19, 2026
3.3.0 – 6.0.5CommonJSNov 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

Similar popularity