canirequire › Dual (CommonJS + ESM) › @rollup/plugin-node-resolve
Is @rollup/plugin-node-resolve ESM-only? Can you require() it?
Locate and bundle third-party dependencies in node_modules
Last verified Sep 9, 2026 against @rollup/plugin-node-resolve@16.0.3. Markdown · JSON
Dual (CommonJS + ESM) Dual package — require() works on every Node.js version we test; import works too
@rollup/plugin-node-resolve publishes both a CommonJS entry and a native ESM entry (ESM added in 8.1.0). require("@rollup/plugin-node-resolve") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. The package declares Node.js >=14.0.0. import "@rollup/plugin-node-resolve" works alongside it.
What to do
- Nothing to change. require("@rollup/plugin-node-resolve") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. The package declares Node.js >=14.0.0. import * as pluginNodeResolve from "@rollup/plugin-node-resolve" works alongside it; use named imports for what the ESM entry exports.
- TypeScript: types are bundled; install nothing extra.
Does @rollup/plugin-node-resolve@16.0.3 actually load? Runtime test results
Installed and executed on Sep 9, 2026 with require("@rollup/plugin-node-resolve") from a CommonJS file and import "@rollup/plugin-node-resolve" from an ES module.
| Runtime | require("@rollup/plugin-node-resolve") | import "@rollup/plugin-node-resolve" |
|---|---|---|
| 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-node-resolve
ES modules (import)
import * as pluginNodeResolve from "@rollup/plugin-node-resolve";Namespace import shown because the ESM entry may have no default export; use named imports for what it exports.
CommonJS (require)
const pluginNodeResolve = require("@rollup/plugin-node-resolve");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 (52 versions; the newest 52 shown).
| Versions | Format | First published |
|---|---|---|
| 8.1.0 – 16.0.3 | Dual (CommonJS + ESM) | Jun 22, 2020 |
| 6.0.0 – 8.0.1 | CommonJS | Dec 3, 2019 |
Frequently asked
Is @rollup/plugin-node-resolve ESM-only?
@rollup/plugin-node-resolve@16.0.3 ships CommonJS and ESM builds. @rollup/plugin-node-resolve publishes both a CommonJS entry and a native ESM entry (ESM added in 8.1.0). require("@rollup/plugin-node-resolve") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. The package declares Node.js >=14.0.0. import "@rollup/plugin-node-resolve" works alongside it.
Can I require @rollup/plugin-node-resolve?
Yes. @rollup/plugin-node-resolve ships a CommonJS entry alongside the native ESM entry. require("@rollup/plugin-node-resolve") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. The package declares Node.js >=14.0.0.
Does @rollup/plugin-node-resolve work in Bun?
Yes. import "@rollup/plugin-node-resolve" loaded successfully in Bun 1.4.0 on Sep 9, 2026.
Does @rollup/plugin-node-resolve ship TypeScript types?
Yes. @rollup/plugin-node-resolve 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
- npmlog 7.0.1CommonJS
- three 0.186.0ESM-only
- npm 12.0.2CommonJS
- vue 3.5.42Dual
- graphql-tag 2.12.7CommonJS
- mocha 12.0.0ESM-only
- html-webpack-plugin 5.6.8CommonJS
- querystring 0.2.1CommonJS