canirequire › Dual (CommonJS + ESM) › fdir
Is fdir ESM-only? Can you require() it?
The fastest directory crawler & globbing alternative to glob, fast-glob, & tiny-glob. Crawls 1m files in < 1s
Last verified Sep 9, 2026 against fdir@6.5.0. JSON
Dual (CommonJS + ESM) Dual package — both require() and import work
fdir publishes both a CommonJS entry and a native ESM entry (ESM added in 6.5.0). require("fdir") and import "fdir" both work on every supported Node.js version and in Bun.
Does fdir@6.5.0 actually load? Runtime test results
Installed and executed on Sep 9, 2026 with require("fdir") from a CommonJS file and import "fdir" from an ES module.
| Runtime | require("fdir") | import "fdir" |
|---|---|---|
| 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 fdir
ES modules (import)
import fdir from "fdir";CommonJS (require)
const fdir = require("fdir");Module format by version
Derived from the type, main and exports fields of every stable release on npm (45 versions; the newest 45 shown).
| Versions | Format | First published |
|---|---|---|
| 6.5.0 | Dual (CommonJS + ESM) | Aug 14, 2025 |
| 1.0.0 – 6.4.6 | CommonJS | Mar 13, 2020 |
Frequently asked
Is fdir ESM-only?
fdir@6.5.0 ships CommonJS and ESM builds. fdir publishes both a CommonJS entry and a native ESM entry (ESM added in 6.5.0). require("fdir") and import "fdir" both work on every supported Node.js version and in Bun.
Can I require fdir?
Yes. fdir ships a CommonJS entry, so require("fdir") works on every Node.js version, alongside the native ESM entry for import.
Does fdir work in Bun?
Yes. import "fdir" loaded successfully in Bun 1.4 on Sep 9, 2026.
Does fdir ship TypeScript types?
Yes. fdir 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
- 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
- has-flag 5.0.1ESM-only
- qs 6.16.0CommonJS
- node-releases 2.0.55ESM-only
- onetime 8.0.0ESM-only
- pnpm 12.3.4ESM-only
- estree-walker 3.0.3Dual
- is-extglob 2.1.1CommonJS
- jsesc 3.1.0CommonJS