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

> event-target-shim@6.0.2 ships CommonJS and ESM builds. Dual package — require() works on every Node.js version we test; import works too.

An implementation of WHATWG EventTarget interface.

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

event-target-shim publishes both a CommonJS entry and a native ESM entry (ESM added in 6.0.0). require("event-target-shim") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. The package declares Node.js >=10.13.0. import "event-target-shim" works alongside it.

## What to do

1. Nothing to change. require("event-target-shim") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. The package declares Node.js >=10.13.0. import * as eventTargetShim from "event-target-shim" works alongside it; use named imports for what the ESM entry exports.
2. TypeScript: no types are available for event-target-shim; declare the module yourself if you need them.

## Facts

- 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

## Runtime test results for event-target-shim@6.0.2

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.

| Runtime | require("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.0 | works | works |

## How to import event-target-shim

ES modules:

```js
import * as eventTargetShim from "event-target-shim";
```

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

CommonJS:

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

| Versions | Format | First published |
|---|---|---|
| 6.0.0 – 6.0.2 | Dual (CommonJS + ESM) | Jan 6, 2021 |
| 0.0.1 – 5.0.1 | CommonJS | Feb 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") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. The package declares Node.js >=10.13.0. import "event-target-shim" works alongside it.

**Can I require event-target-shim?**

Yes. event-target-shim ships a CommonJS entry alongside the native ESM entry. require("event-target-shim") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. The package declares Node.js >=10.13.0.

**Does event-target-shim work in Bun?**

Yes. import "event-target-shim" loaded successfully in Bun 1.4.0 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

- [event-target-shim on npm](https://www.npmjs.com/package/event-target-shim)
- [Source repository](https://github.com/mysticatea/event-target-shim)
- [HTML version](https://canirequire.com/package/event-target-shim/)
- [JSON version](https://canirequire.com/package/event-target-shim.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.
