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

> rollup-plugin-esbuild@6.2.1 ships CommonJS and ESM builds. Dual package — require() works on every Node.js version we test; import works too.

**💛 You can help the author become a full-time open-source maintainer by [sponsoring him on GitHub](https://github.com/sponsors/egoist).**

Last verified Sep 9, 2026 against rollup-plugin-esbuild@6.2.1.

rollup-plugin-esbuild publishes both a CommonJS entry and a native ESM entry (ESM added in 4.7.2). require("rollup-plugin-esbuild") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. The package declares Node.js >=14.18.0. import "rollup-plugin-esbuild" works alongside it.

## What to do

1. Nothing to change. require("rollup-plugin-esbuild") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. The package declares Node.js >=14.18.0. import * as rollupPluginEsbuild from "rollup-plugin-esbuild" works alongside it; use named imports for what the ESM entry exports.
2. TypeScript: types are bundled; install nothing extra.

## Facts

- Latest: 6.2.1 (Feb 27, 2025)
- Module format: Dual (CommonJS + ESM)
- Last CommonJS version: 6.2.1
- Native ESM since: 4.7.2
- TypeScript types: bundled
- Node engines: >=14.18.0
- Weekly downloads: 901K
- License: MIT

## Runtime test results for rollup-plugin-esbuild@6.2.1

Installed and executed on Sep 9, 2026 with require("rollup-plugin-esbuild") from a CommonJS file and import "rollup-plugin-esbuild" from an ES module.

| Runtime | require("rollup-plugin-esbuild") | import "rollup-plugin-esbuild" |
|---|---|---|
| Node.js 18 | works | works |
| Node.js 20 | works | works |
| Node.js 22 | works | works |
| Node.js 24 | works | works |
| Node.js 26 | works | works |
| Bun 1.4.0 | works | works |

## How to import rollup-plugin-esbuild

ES modules:

```js
import * as rollupPluginEsbuild from "rollup-plugin-esbuild";
```

Namespace import shown because the ESM entry may have no default export; use named imports for what it exports.

CommonJS:

```js
const rollupPluginEsbuild = require("rollup-plugin-esbuild");
```

## Module format by version

Derived from the type, main and exports fields of every stable release on npm (65 versions; the newest 60 shown).

| Versions | Format | First published |
|---|---|---|
| 4.7.2 – 6.2.1 | Dual (CommonJS + ESM) | Nov 19, 2021 |
| 1.3.0 – 4.7.1 | CommonJS | May 9, 2020 |

## Frequently asked

**Is rollup-plugin-esbuild ESM-only?**

rollup-plugin-esbuild@6.2.1 ships CommonJS and ESM builds. rollup-plugin-esbuild publishes both a CommonJS entry and a native ESM entry (ESM added in 4.7.2). require("rollup-plugin-esbuild") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. The package declares Node.js >=14.18.0. import "rollup-plugin-esbuild" works alongside it.

**Can I require rollup-plugin-esbuild?**

Yes. rollup-plugin-esbuild ships a CommonJS entry alongside the native ESM entry. require("rollup-plugin-esbuild") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. The package declares Node.js >=14.18.0.

**Does rollup-plugin-esbuild work in Bun?**

Yes. import "rollup-plugin-esbuild" loaded successfully in Bun 1.4.0 on Sep 9, 2026.

**Does rollup-plugin-esbuild ship TypeScript types?**

Yes. rollup-plugin-esbuild bundles its own type declarations; no @types package is needed.

## Links

- [rollup-plugin-esbuild on npm](https://www.npmjs.com/package/rollup-plugin-esbuild)
- [Source repository](https://github.com/egoist/rollup-plugin-esbuild)
- [HTML version](https://canirequire.com/package/rollup-plugin-esbuild/)
- [JSON version](https://canirequire.com/package/rollup-plugin-esbuild.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.
