canirequire › Dual (CommonJS + ESM) › element-plus
Is element-plus ESM-only? Can you require() it?
A Component Library for Vue 3
Last verified Sep 9, 2026 against element-plus@2.14.5. Markdown · JSON
Dual (CommonJS + ESM) Dual package — require() works on Node.js 20, 22, 24 and 26, fails on 18; import works too
element-plus publishes both a CommonJS entry and a native ESM entry (ESM added in 2.0.0). require("element-plus") works on Node.js 20, 22, 24 and 26 but fails on Node.js 18 (ERR_REQUIRE_ESM). import "element-plus" works alongside it.
What to do
- Nothing to change. require("element-plus") works on Node.js 20, 22, 24 and 26 but fails on Node.js 18 (ERR_REQUIRE_ESM). import * as elementPlus from "element-plus" works alongside it; use named imports for what the ESM entry exports.
- TypeScript: types are bundled; install nothing extra.
Does element-plus@2.14.5 actually load? Runtime test results
Installed and executed on Sep 9, 2026 with require("element-plus") from a CommonJS file and import "element-plus" from an ES module.
| Runtime | require("element-plus") | import "element-plus" |
|---|---|---|
| Node.js 18 | ✗ failsERR_REQUIRE_ESM | ✓ 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 |
A failing require() on a CommonJS package usually means the package needs a browser/DOM global, a peer dependency, or a native binary that is not available in a bare Node.js process.
How to import element-plus
ES modules (import)
import * as elementPlus from "element-plus";Namespace import shown because the ESM entry may have no default export; use named imports for what it exports.
CommonJS (require)
const elementPlus = require("element-plus");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 (148 versions; the newest 60 shown).
| Versions | Format | First published |
|---|---|---|
| 2.7.2 – 2.14.5 | Dual (CommonJS + ESM) | Apr 26, 2024 |
Frequently asked
Is element-plus ESM-only?
element-plus@2.14.5 ships CommonJS and ESM builds. element-plus publishes both a CommonJS entry and a native ESM entry (ESM added in 2.0.0). require("element-plus") works on Node.js 20, 22, 24 and 26 but fails on Node.js 18 (ERR_REQUIRE_ESM). import "element-plus" works alongside it.
Can I require element-plus?
Yes. element-plus ships a CommonJS entry alongside the native ESM entry. require("element-plus") works on Node.js 20, 22, 24 and 26 but fails on Node.js 18 (ERR_REQUIRE_ESM).
Does element-plus work in Bun?
Yes. import "element-plus" loaded successfully in Bun 1.4.0 on Sep 9, 2026.
Does element-plus ship TypeScript types?
Yes. element-plus 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
- jest-styled-components 7.4.0CommonJS
- babel-plugin-transform-flow-strip-types 6.22.0CommonJS
- watch 1.0.2CommonJS
- rollup-plugin-sourcemaps 0.6.3Dual
- coveralls 3.1.1CommonJS
- babel-plugin-transform-react-jsx 6.24.1CommonJS
- uglify-es 3.3.9CommonJS
- eslint-plugin-markdown 5.1.0CommonJS