canirequire › Dual (CommonJS + ESM) › @emnapi/runtime
Is @emnapi/runtime ESM-only? Can you require() it?
emnapi runtime
Last verified Sep 9, 2026 against @emnapi/runtime@1.11.3. Markdown · JSON
Dual (CommonJS + ESM) Dual package — require() works on every Node.js version we test; import works too
@emnapi/runtime publishes both a CommonJS entry and a native ESM entry (ESM added in 0.31.0). require("@emnapi/runtime") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. import "@emnapi/runtime" works alongside it.
What to do
- Nothing to change. require("@emnapi/runtime") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. import * as runtime from "@emnapi/runtime" works alongside it; use named imports for what the ESM entry exports.
- TypeScript: types are bundled; install nothing extra.
Does @emnapi/runtime@1.11.3 actually load? Runtime test results
Installed and executed on Sep 9, 2026 with require("@emnapi/runtime") from a CommonJS file and import "@emnapi/runtime" from an ES module.
| Runtime | require("@emnapi/runtime") | import "@emnapi/runtime" |
|---|---|---|
| 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 @emnapi/runtime
ES modules (import)
import * as runtime from "@emnapi/runtime";Namespace import shown because the ESM entry may have no default export; use named imports for what it exports.
CommonJS (require)
const runtime = require("@emnapi/runtime");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 (50 versions; the newest 50 shown).
| Versions | Format | First published |
|---|---|---|
| 0.31.0 – 1.11.3 | Dual (CommonJS + ESM) | Feb 14, 2023 |
Frequently asked
Is @emnapi/runtime ESM-only?
@emnapi/runtime@1.11.3 ships CommonJS and ESM builds. @emnapi/runtime publishes both a CommonJS entry and a native ESM entry (ESM added in 0.31.0). require("@emnapi/runtime") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. import "@emnapi/runtime" works alongside it.
Can I require @emnapi/runtime?
Yes. @emnapi/runtime ships a CommonJS entry alongside the native ESM entry. require("@emnapi/runtime") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun.
Does @emnapi/runtime work in Bun?
Yes. import "@emnapi/runtime" loaded successfully in Bun 1.4.0 on Sep 9, 2026.
Does @emnapi/runtime ship TypeScript types?
Yes. @emnapi/runtime 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
- @babel/plugin-syntax-jsx 8.0.1ESM-only
- tsconfig-paths 4.2.0CommonJS
- tiny-invariant 1.3.3Dual
- @isaacs/cliui 9.0.0Dual
- is-negative-zero 2.0.3CommonJS
- @pkgjs/parseargs 0.11.0CommonJS
- @floating-ui/react-dom 2.1.9Dual
- for-each 0.3.5CommonJS