# Is rollup-plugin-visualizer ESM-only? Can you require() it?

> rollup-plugin-visualizer@7.1.1 is ESM-only. ESM-only since 7.0.0 — last CommonJS version is 6.0.11.

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.

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.

## Facts

- 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

## Runtime test results for rollup-plugin-visualizer@7.1.1

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 | fails (ERR_PACKAGE_PATH_NOT_EXPORTED) | works |
| Node.js 20 | fails (ERR_PACKAGE_PATH_NOT_EXPORTED) | works |
| Node.js 22 | fails (ERR_PACKAGE_PATH_NOT_EXPORTED) | works |
| Node.js 24 | fails (ERR_PACKAGE_PATH_NOT_EXPORTED) | works |
| Node.js 26 | fails (ERR_PACKAGE_PATH_NOT_EXPORTED) | works |
| Bun 1.4.0 | fails (Error) | works |

## How to import rollup-plugin-visualizer

ES modules:

```js
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:

```js
// 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 (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

- [rollup-plugin-visualizer on npm](https://www.npmjs.com/package/rollup-plugin-visualizer)
- [Source repository](https://github.com/btd/rollup-plugin-visualizer)
- [HTML version](https://canirequire.com/package/rollup-plugin-visualizer/)
- [JSON version](https://canirequire.com/package/rollup-plugin-visualizer.json)

---

For scripts and AI agents: any package is at https://canirequire.com/package/<name>/index.md (Markdown) or https://canirequire.com/package/<name>.json (JSON); the site index is https://canirequire.com/llms.txt. Fetch the URL directly; no search needed.
