canirequire

canirequireDual (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.

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

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.

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

VersionsFormatFirst published
4.7.2 – 6.2.1Dual (CommonJS + ESM)Nov 19, 2021
1.3.0 – 4.7.1CommonJSMay 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

Similar popularity