canirequire

canirequireDual (CommonJS + ESM) › event-target-shim

Is event-target-shim ESM-only? Can you require() it?

An implementation of WHATWG EventTarget interface.

Last verified Sep 9, 2026 against event-target-shim@6.0.2. JSON

Dual (CommonJS + ESM) Dual package — both require() and import work

event-target-shim publishes both a CommonJS entry and a native ESM entry (ESM added in 6.0.0). require("event-target-shim") and import "event-target-shim" both work on every supported Node.js version and in Bun.

Latest
6.0.2 (Jan 7, 2021)
Module format
Dual (CommonJS + ESM)
Last CommonJS version
6.0.2
Native ESM since
6.0.0
TypeScript types
None
Node engines
>=10.13.0
Weekly downloads
62.8M
License
MIT

Does event-target-shim@6.0.2 actually load? Runtime test results

Installed and executed on Sep 9, 2026 with require("event-target-shim") from a CommonJS file and import "event-target-shim" from an ES module.

Runtimerequire("event-target-shim")import "event-target-shim"
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 event-target-shim

ES modules (import)

import eventTargetShim from "event-target-shim";

CommonJS (require)

const eventTargetShim = require("event-target-shim");

Module format by version

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

VersionsFormatFirst published
6.0.0 – 6.0.2Dual (CommonJS + ESM)Jan 6, 2021
0.0.1 – 5.0.1CommonJSFeb 22, 2015

Frequently asked

Is event-target-shim ESM-only?

event-target-shim@6.0.2 ships CommonJS and ESM builds. event-target-shim publishes both a CommonJS entry and a native ESM entry (ESM added in 6.0.0). require("event-target-shim") and import "event-target-shim" both work on every supported Node.js version and in Bun.

Can I require event-target-shim?

Yes. event-target-shim ships a CommonJS entry, so require("event-target-shim") works on every Node.js version, alongside the native ESM entry for import.

Does event-target-shim work in Bun?

Yes. import "event-target-shim" loaded successfully in Bun 1.4 on Sep 9, 2026.

Does event-target-shim ship TypeScript types?

No. event-target-shim ships no type declarations and there is no @types package for it.

Links

Other dual (commonjs + esm) packages

Similar popularity