canirequire โบ Dual (CommonJS + ESM) โบ rollup-plugin-esbuild
Is rollup-plugin-esbuild ESM-only? Can you require() it?
**๐ 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. Markdown ยท JSON
Dual (CommonJS + ESM) Dual package โ require() works on every Node.js version we test; import works too
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
- 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.
- TypeScript: types are bundled; install nothing extra.
Does rollup-plugin-esbuild@6.2.1 actually load? Runtime test results
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 (import)
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 (require)
const rollupPluginEsbuild = require("rollup-plugin-esbuild");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 (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
Other dual (commonjs + esm) packages
- minimatch 10.2.6Dual
- brace-expansion 5.0.9Dual
- lru-cache 11.5.2Dual
- tslib 2.8.1Dual
- glob 13.0.6Dual
- eslint-visitor-keys 5.0.1Dual
- yallist 5.0.0Dual
- balanced-match 4.0.4Dual
Similar popularity
- postcss-url 10.1.4CommonJS
- coffee-script 1.12.7CommonJS
- gulp-rename 2.1.0CommonJS
- metro-react-native-babel-preset 0.77.0CommonJS
- @ethersproject/solidity 5.8.0CommonJS
- babel-plugin-syntax-dynamic-import 6.18.0CommonJS
- node-sass 9.0.0CommonJS
- chromedriver 152.0.3CommonJS