canirequire

canirequireDual (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.

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
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✓ 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).

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") 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

Similar popularity