# Is @napi-rs/wasm-runtime ESM-only? Can you require() it?

> @napi-rs/wasm-runtime@1.2.3 ships CommonJS and ESM builds. Dual package — require() works on every Node.js version we test; import works too.

Runtime and polyfill for wasm targets

Last verified Sep 9, 2026 against @napi-rs/wasm-runtime@1.2.3.

@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.

## Facts

- 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

## Runtime test results for @napi-rs/wasm-runtime@1.2.3

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:

```js
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:

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

- [@napi-rs/wasm-runtime on npm](https://www.npmjs.com/package/@napi-rs/wasm-runtime)
- [Source repository](https://github.com/napi-rs/napi-rs)
- [HTML version](https://canirequire.com/package/@napi-rs/wasm-runtime/)
- [JSON version](https://canirequire.com/package/@napi-rs/wasm-runtime.json)

---

For scripts and AI agents: any package is at https://canirequire.com/package/<name>/index.md (Markdown) or https://canirequire.com/package/<name>.json (JSON); the site index is https://canirequire.com/llms.txt. Fetch the URL directly; no search needed.
