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. JSON
Dual (CommonJS + ESM) Dual package — both require() and import work
@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") and import "@napi-rs/wasm-runtime" both work on every supported Node.js version and in Bun.
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 | ✓ works | ✓ works |
How to import @napi-rs/wasm-runtime
ES modules (import)
import wasmRuntime from "@napi-rs/wasm-runtime";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 (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") and import "@napi-rs/wasm-runtime" both work on every supported Node.js version and in Bun.
Can I require @napi-rs/wasm-runtime?
Yes. @napi-rs/wasm-runtime ships a CommonJS entry, so require("@napi-rs/wasm-runtime") works on every Node.js version, alongside the native ESM entry for import.
Does @napi-rs/wasm-runtime work in Bun?
Yes. import "@napi-rs/wasm-runtime" loaded successfully in Bun 1.4 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
- glob 13.0.6Dual
- eslint-visitor-keys 5.0.1Dual
- yallist 5.0.0Dual
- balanced-match 4.0.4Dual
- js-yaml 5.4.1Dual
Similar popularity
- @aws-sdk/xml-builder 3.972.40CommonJS
- @smithy/smithy-client 4.15.2CommonJS
- @sinonjs/commons 4.0.0-alpha.0Dual
- @rollup/pluginutils 5.4.0Dual
- @openai/codex 0.153.4ESM-only
- @jest/console 30.5.1Dual
- @radix-ui/react-use-previous 1.1.4Dual
- @smithy/middleware-endpoint 4.7.2CommonJS