canirequire › Dual (CommonJS + ESM) › @napi-rs/wasm-runtime
Is @napi-rs/wasm-runtime ESM-only? Can you require() it?
Runtime and polyfill for wasm targets
Last verified Sep 9, 2026 against @napi-rs/wasm-runtime@1.2.3. Markdown · JSON
Dual (CommonJS + ESM) Dual package — require() works on every Node.js version we test; import works too
@napi-rs/wasm-runtime publishes both a CommonJS entry and a native ESM entry (ESM added in 0.1.0). require("@napi-rs/wasm-runtime") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. The package declares Node.js ^20.19.0 || ^22.13.0 || >=23.5.0. import "@napi-rs/wasm-runtime" works alongside it.
What to do
- Nothing to change. require("@napi-rs/wasm-runtime") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. The package declares Node.js ^20.19.0 || ^22.13.0 || >=23.5.0. import * as wasmRuntime from "@napi-rs/wasm-runtime" works alongside it; use named imports for what the ESM entry exports.
- TypeScript: no types are available for @napi-rs/wasm-runtime; declare the module yourself if you need them.
Does @napi-rs/wasm-runtime@1.2.3 actually load? Runtime test results
Installed and executed on Sep 9, 2026 with require("@napi-rs/wasm-runtime") from a CommonJS file and import "@napi-rs/wasm-runtime" from an ES module.
| Runtime | require("@napi-rs/wasm-runtime") | import "@napi-rs/wasm-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 @napi-rs/wasm-runtime
ES modules (import)
import * as wasmRuntime from "@napi-rs/wasm-runtime";Namespace import shown because the ESM entry may have no default export; use named imports for what it exports.
CommonJS (require)
const wasmRuntime = require("@napi-rs/wasm-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 (35 versions; the newest 35 shown).
| Versions | Format | First published |
|---|---|---|
| 0.1.1 – 1.2.3 | Dual (CommonJS + ESM) | Jan 16, 2024 |
| 0.1.0 | ESM-only | Jan 16, 2024 |
Frequently asked
Is @napi-rs/wasm-runtime ESM-only?
@napi-rs/wasm-runtime@1.2.3 ships CommonJS and ESM builds. @napi-rs/wasm-runtime publishes both a CommonJS entry and a native ESM entry (ESM added in 0.1.0). require("@napi-rs/wasm-runtime") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. The package declares Node.js ^20.19.0 || ^22.13.0 || >=23.5.0. import "@napi-rs/wasm-runtime" works alongside it.
Can I require @napi-rs/wasm-runtime?
Yes. @napi-rs/wasm-runtime ships a CommonJS entry alongside the native ESM entry. require("@napi-rs/wasm-runtime") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. The package declares Node.js ^20.19.0 || ^22.13.0 || >=23.5.0.
Does @napi-rs/wasm-runtime work in Bun?
Yes. import "@napi-rs/wasm-runtime" loaded successfully in Bun 1.4.0 on Sep 9, 2026.
Does @napi-rs/wasm-runtime ship TypeScript types?
No. @napi-rs/wasm-runtime ships no type declarations and there is no @types package for it.
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
- @tanstack/react-query 5.102.8Dual
- is-data-view 1.0.2CommonJS
- @protobufjs/aspromise 1.1.2CommonJS
- @csstools/css-calc 3.3.0ESM-only
- immer 11.1.18Dual
- @inquirer/type 4.1.1ESM-only
- class-variance-authority 0.7.1Dual
- eslint-plugin-react 7.37.5CommonJS