canirequire › ESM-only › @rollup/plugin-alias
Is @rollup/plugin-alias ESM-only? Can you require() it?
Define and resolve aliases for bundle dependencies
Last verified Sep 9, 2026 against @rollup/plugin-alias@6.0.0. Markdown · JSON
ESM-only ESM-only since 6.0.0 — last CommonJS version is 5.1.1
@rollup/plugin-alias dropped its CommonJS build in 6.0.0 (October 2025). The last version with a plain require()-able CommonJS entry is 5.1.1, published Sep 22, 2024; it declares support for Node.js >=14.0.0.
require("@rollup/plugin-alias") failed in our probe on Node.js 20+ as well; see the runtime table for the error before relying on it. Node.js 18 has no require(esm), and @rollup/plugin-alias@6.0.0 declares Node.js >=20.19.0, so 18 is outside its supported range anyway.
@rollup/plugin-alias@6.0.0 declares engines ">=20.19.0", so Node.js 18 is outside its supported range regardless of module format.
What to do
- require("@rollup/plugin-alias") failed in our probe on Node.js 20+ as well; see the runtime table for the error before relying on it.
- From a CommonJS file, use a dynamic import inside an async function: const pluginAlias = await import("@rollup/plugin-alias"). That works on every Node.js version the package supports (>=20.19.0).
- If you need a synchronous require() or run Node.js 18: npm install @rollup/plugin-alias@5.1.1, the last CommonJS release (published Sep 22, 2024); it declares Node.js >=14.0.0.
- @rollup/plugin-alias@6.0.0 declares engines ">=20.19.0", so Node.js 18 is unsupported regardless: upgrade Node.js or pin an older release.
- TypeScript: types are bundled; install nothing extra.
Does @rollup/plugin-alias@6.0.0 actually load? Runtime test results
Installed and executed on Sep 9, 2026 with require("@rollup/plugin-alias") from a CommonJS file and import "@rollup/plugin-alias" from an ES module.
| Runtime | require("@rollup/plugin-alias") | import "@rollup/plugin-alias" |
|---|---|---|
| Node.js 18 | ✗ failsERR_PACKAGE_PATH_NOT_EXPORTED | ✓ works |
| Node.js 20 | ✗ failsERR_PACKAGE_PATH_NOT_EXPORTED | ✓ works |
| Node.js 22 | ✗ failsERR_PACKAGE_PATH_NOT_EXPORTED | ✓ works |
| Node.js 24 | ✗ failsERR_PACKAGE_PATH_NOT_EXPORTED | ✓ works |
| Node.js 26 | ✗ failsERR_PACKAGE_PATH_NOT_EXPORTED | ✓ works |
| Bun 1.4.0 | ✗ failsError | ✓ works |
How to import @rollup/plugin-alias
ES modules (import)
import * as pluginAlias from "@rollup/plugin-alias";Namespace import shown because the ESM entry may have no default export; use named imports for what it exports.
CommonJS (require)
// require("@rollup/plugin-alias") failed in our probe on Node.js 20.19+, 22.12+ and newer as well (ERR_PACKAGE_PATH_NOT_EXPORTED); see the runtime table.
// Any Node.js version the package supports (>=20.19.0), from an async function:
async function main() {
const pluginAlias = await import("@rollup/plugin-alias");
}
// Or pin the last CommonJS release (declares Node.js >=14.0.0):
// npm install @rollup/plugin-alias@5.1.1Module 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 (23 versions; the newest 23 shown).
| Versions | Format | First published |
|---|---|---|
| 6.0.0 | ESM-only | Oct 28, 2025 |
| 4.0.0 – 5.1.1 | Dual (CommonJS + ESM) | Oct 7, 2022 |
| 2.2.0 – 3.1.9 | CommonJS | Oct 30, 2019 |
Frequently asked
Is @rollup/plugin-alias ESM-only?
@rollup/plugin-alias@6.0.0 is ESM-only. @rollup/plugin-alias dropped its CommonJS build in 6.0.0 (October 2025). The last version with a plain require()-able CommonJS entry is 5.1.1, published Sep 22, 2024; it declares support for Node.js >=14.0.0.
Which version of @rollup/plugin-alias still supports CommonJS / require()?
5.1.1 is the last version of @rollup/plugin-alias with a CommonJS build; it declares Node.js >=14.0.0. Install it with "npm install @rollup/plugin-alias@5.1.1". Every version from 6.0.0 on is ESM-only.
How do I use @rollup/plugin-alias from a CommonJS file?
From a CommonJS file, use a dynamic import inside an async function: const pluginAlias = await import("@rollup/plugin-alias"). That works on every Node.js version the package supports (>=20.19.0). require("@rollup/plugin-alias") failed in our probe on Node.js 20+ as well; see the runtime table for the error before relying on it. Alternatively pin @rollup/plugin-alias@5.1.1 (declares Node.js >=14.0.0).
Does @rollup/plugin-alias work in Bun?
Yes. import "@rollup/plugin-alias" loaded successfully in Bun 1.4.0 on Sep 9, 2026.
Does @rollup/plugin-alias ship TypeScript types?
Yes. @rollup/plugin-alias bundles its own type declarations; no @types package is needed.
Links
Other esm-only packages
- ansi-styles 7.0.0last CJS
5.2.0 - strip-ansi 7.2.0last CJS
6.0.1 - commander 15.0.0last CJS
14.0.3 - supports-color 11.0.0last CJS
8.1.1 - chalk 6.0.0last CJS
4.1.2 - string-width 8.2.2last CJS
4.2.3 - ansi-regex 6.3.0last CJS
5.0.1 - escape-string-regexp 5.0.0last CJS
4.0.0
Similar popularity
- express-session 1.19.0CommonJS
- path 0.12.7CommonJS
- babel-plugin-styled-components 2.3.0CommonJS
- node-notifier 10.0.1CommonJS
- raw-loader 4.0.2CommonJS
- react-dev-utils 12.0.1No entry
- @angular/compiler-cli 22.1.5ESM-only
- @storybook/builder-webpack5 10.6.0ESM-only