canirequire › Dual (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.
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.
| 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 | ✓ 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).
| 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") 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
- minimatch 10.2.6Dual
- brace-expansion 5.0.9Dual
- lru-cache 11.5.2Dual
- glob 13.0.6Dual
- eslint-visitor-keys 5.0.1Dual
- yallist 5.0.0Dual
- balanced-match 4.0.4Dual
- js-yaml 5.4.1Dual
Similar popularity
- d3-path 3.1.0ESM-only
- strip-indent 4.1.1ESM-only
- jest-mock 30.5.1Dual
- is-symbol 1.1.1CommonJS
- resolve-pkg-maps 1.0.0Dual
- decamelize 6.0.1ESM-only
- @babel/helper-optimise-call-expression 8.0.0ESM-only
- tinybench 6.1.6ESM-only