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. 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 you can require() on every Node.js version, including 18 and older, is 5.1.1, published Sep 22, 2024.
require("@rollup/plugin-alias") failed in our probe on Node.js 20+ as well. See the runtime matrix below for the exact error.
@rollup/plugin-alias@6.0.0 declares engines ">=20.19.0", so Node.js 18 is outside its supported range regardless of module format.
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 | ✗ failserror: Cannot find module '@rollup/plugin-alias' from '/Users/boat/Projects/top-seo/data/probe-work/@rollup__plugin-alias/req.cjs' | ✓ works |
How to import @rollup/plugin-alias
ES modules (import)
import pluginAlias from "@rollup/plugin-alias";CommonJS (require)
// Node.js 20.19+ / 22.12+ / newer (package has no top-level await):
const pluginAlias = require("@rollup/plugin-alias");
// Any Node.js version:
const pluginAlias = await import("@rollup/plugin-alias");
// Or pin the last CommonJS release:
// 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 (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 you can require() on every Node.js version, including 18 and older, is 5.1.1, published Sep 22, 2024.
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. 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?
Use a dynamic import: const mod = await import("@rollup/plugin-alias"). On Node.js 20.19+, 22.12+ and newer, a plain require("@rollup/plugin-alias") also works for ESM packages that do not use top-level await. Alternatively pin @rollup/plugin-alias@5.1.1.
Does @rollup/plugin-alias work in Bun?
Yes. import "@rollup/plugin-alias" loaded successfully in Bun 1.4 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 - tslib 2.8.1last CJS
2.5.2 - string-width 8.2.2last CJS
4.2.3 - ansi-regex 6.3.0last CJS
5.0.1
Similar popularity
- @oclif/plugin-help 7.0.0ESM-only
- @changesets/cli 3.0.2ESM-only
- @rollup/plugin-typescript 12.3.0Dual
- @fortawesome/fontawesome-svg-core 7.3.1Dual
- @fortawesome/free-solid-svg-icons 7.3.1Dual
- @semantic-release/npm 13.1.5ESM-only
- @storybook/addons 7.6.17Dual
- @semantic-release/commit-analyzer 13.0.1ESM-only