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. JSON
Dual (CommonJS + ESM) Dual package — both require() and import work
rollup-plugin-esbuild publishes both a CommonJS entry and a native ESM entry (ESM added in 4.7.2). require("rollup-plugin-esbuild") and import "rollup-plugin-esbuild" both work on every supported Node.js version and in Bun.
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 | ✓ works | ✓ works |
How to import rollup-plugin-esbuild
ES modules (import)
import rollupPluginEsbuild from "rollup-plugin-esbuild";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 (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") and import "rollup-plugin-esbuild" both work on every supported Node.js version and in Bun.
Can I require rollup-plugin-esbuild?
Yes. rollup-plugin-esbuild ships a CommonJS entry, so require("rollup-plugin-esbuild") works on every Node.js version, alongside the native ESM entry for import.
Does rollup-plugin-esbuild work in Bun?
Yes. import "rollup-plugin-esbuild" loaded successfully in Bun 1.4 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
- glob 13.0.6Dual
- eslint-visitor-keys 5.0.1Dual
- yallist 5.0.0Dual
- balanced-match 4.0.4Dual
- js-yaml 5.4.1Dual
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
- babel-plugin-syntax-dynamic-import 6.18.0CommonJS
- node-sass 9.0.0CommonJS
- chromedriver 152.0.3CommonJS
- request-promise 4.2.6CommonJS