canirequire › Dual (CommonJS + ESM) › @humanwhocodes/retry
Is @humanwhocodes/retry ESM-only? Can you require() it?
A utility to retry failed async methods.
Last verified Sep 9, 2026 against @humanwhocodes/retry@0.4.3. Markdown · JSON
Dual (CommonJS + ESM) Dual package — require() works on every Node.js version we test; import works too
@humanwhocodes/retry publishes both a CommonJS entry and a native ESM entry (ESM added in 0.1.0). require("@humanwhocodes/retry") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. The package declares Node.js >=18.18. import "@humanwhocodes/retry" works alongside it.
What to do
- Nothing to change. require("@humanwhocodes/retry") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. The package declares Node.js >=18.18. import * as retry from "@humanwhocodes/retry" works alongside it; use named imports for what the ESM entry exports.
- TypeScript: types are bundled; install nothing extra.
Does @humanwhocodes/retry@0.4.3 actually load? Runtime test results
Installed and executed on Sep 9, 2026 with require("@humanwhocodes/retry") from a CommonJS file and import "@humanwhocodes/retry" from an ES module.
| Runtime | require("@humanwhocodes/retry") | import "@humanwhocodes/retry" |
|---|---|---|
| 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 @humanwhocodes/retry
ES modules (import)
import * as retry from "@humanwhocodes/retry";Namespace import shown because the ESM entry may have no default export; use named imports for what it exports.
CommonJS (require)
const retry = require("@humanwhocodes/retry");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 (15 versions; the newest 15 shown).
| Versions | Format | First published |
|---|---|---|
| 0.1.0 – 0.4.3 | Dual (CommonJS + ESM) | Jan 17, 2024 |
Frequently asked
Is @humanwhocodes/retry ESM-only?
@humanwhocodes/retry@0.4.3 ships CommonJS and ESM builds. @humanwhocodes/retry publishes both a CommonJS entry and a native ESM entry (ESM added in 0.1.0). require("@humanwhocodes/retry") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. The package declares Node.js >=18.18. import "@humanwhocodes/retry" works alongside it.
Can I require @humanwhocodes/retry?
Yes. @humanwhocodes/retry ships a CommonJS entry alongside the native ESM entry. require("@humanwhocodes/retry") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. The package declares Node.js >=18.18.
Does @humanwhocodes/retry work in Bun?
Yes. import "@humanwhocodes/retry" loaded successfully in Bun 1.4.0 on Sep 9, 2026.
Does @humanwhocodes/retry ship TypeScript types?
Yes. @humanwhocodes/retry bundles its own type declarations; no @types package is needed.
Links
Other dual (commonjs + esm) packages
- minimatch 10.2.6Dual
- brace-expansion 5.0.9Dual
- lru-cache 11.5.2Dual
- tslib 2.8.1Dual
- glob 13.0.6Dual
- eslint-visitor-keys 5.0.1Dual
- yallist 5.0.0Dual
- balanced-match 4.0.4Dual
Similar popularity
- mdn-data 2.35.0CommonJS
- chai 6.2.2ESM-only
- accepts 1.3.8CommonJS
- schema-utils 4.4.0CommonJS
- npm-run-path 6.0.0ESM-only
- jest-util 30.5.1Dual
- depd 2.0.0CommonJS
- tinyrainbow 3.1.1ESM-only