# Is @ungap/structured-clone ESM-only? Can you require() it?

> @ungap/structured-clone@1.4.0 ships CommonJS and ESM builds. Dual package — require() works on every Node.js version we test; import works too.

A structuredClone polyfill

Last verified Sep 9, 2026 against @ungap/structured-clone@1.4.0.

@ungap/structured-clone publishes both a CommonJS entry and a native ESM entry (ESM added in 0.0.0). require("@ungap/structured-clone") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. import "@ungap/structured-clone" works alongside it.

## What to do

1. Nothing to change. require("@ungap/structured-clone") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. import * as structuredClone from "@ungap/structured-clone" works alongside it; use named imports for what the ESM entry exports.
2. TypeScript: npm install -D @types/ungap__structured-clone

## Facts

- Latest: 1.4.0 (Aug 27, 2026)
- Module format: Dual (CommonJS + ESM)
- Last CommonJS version: 1.4.0
- Native ESM since: 0.0.0
- TypeScript types: @types/ungap__structured-clone
- Node engines: not declared
- Weekly downloads: 75.6M
- License: ISC

## Runtime test results for @ungap/structured-clone@1.4.0

Installed and executed on Sep 9, 2026 with require("@ungap/structured-clone") from a CommonJS file and import "@ungap/structured-clone" from an ES module.

| Runtime | require("@ungap/structured-clone") | import "@ungap/structured-clone" |
|---|---|---|
| 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 @ungap/structured-clone

ES modules:

```js
import * as structuredClone from "@ungap/structured-clone";
```

Namespace import shown because the ESM entry may have no default export; use named imports for what it exports.

CommonJS:

```js
const structuredClone = require("@ungap/structured-clone");
```

## Module format by version

Derived from the type, main and exports fields of every stable release on npm (27 versions; the newest 27 shown).

| Versions | Format | First published |
|---|---|---|
| 0.0.0 – 1.4.0 | Dual (CommonJS + ESM) | Oct 29, 2021 |

## Frequently asked

**Is @ungap/structured-clone ESM-only?**

@ungap/structured-clone@1.4.0 ships CommonJS and ESM builds. @ungap/structured-clone publishes both a CommonJS entry and a native ESM entry (ESM added in 0.0.0). require("@ungap/structured-clone") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. import "@ungap/structured-clone" works alongside it.

**Can I require @ungap/structured-clone?**

Yes. @ungap/structured-clone ships a CommonJS entry alongside the native ESM entry. require("@ungap/structured-clone") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun.

**Does @ungap/structured-clone work in Bun?**

Yes. import "@ungap/structured-clone" loaded successfully in Bun 1.4.0 on Sep 9, 2026.

**Does @ungap/structured-clone ship TypeScript types?**

Not bundled. Install the community types with "npm install -D @types/ungap__structured-clone".

## Links

- [@ungap/structured-clone on npm](https://www.npmjs.com/package/@ungap/structured-clone)
- [Source repository](https://github.com/ungap/structured-clone)
- [HTML version](https://canirequire.com/package/@ungap/structured-clone/)
- [JSON version](https://canirequire.com/package/@ungap/structured-clone.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.
