canirequire

canirequire › Dual (CommonJS + ESM) › @ungap/structured-clone

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

A structuredClone polyfill

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

Dual (CommonJS + ESM) Dual package — require() works on every Node.js version we test; import works too

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

Does @ungap/structured-clone@1.4.0 actually load? Runtime test results

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.

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

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 (require)

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

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 (27 versions; the newest 27 shown).

VersionsFormatFirst published
0.0.0 – 1.4.0Dual (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

Other dual (commonjs + esm) packages

Similar popularity