canirequire

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

  1. 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.
  2. TypeScript: no types are available for @napi-rs/wasm-runtime; declare the module yourself if you need them.
Latest
1.2.3 (Aug 12, 2026)
Module format
Dual (CommonJS + ESM)
Last CommonJS version
1.2.3
Native ESM since
0.1.0
TypeScript types
None
Node engines
^20.19.0 || ^22.13.0 || >=23.5.0
Weekly downloads
54.5M
License
MIT

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.

Runtimerequire("@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).

VersionsFormatFirst published
0.1.1 – 1.2.3Dual (CommonJS + ESM)Jan 16, 2024
0.1.0ESM-onlyJan 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

Similar popularity