canirequire

canirequireDual (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.

Latest
6.5.0 (Aug 14, 2025)
Module format
Dual (CommonJS + ESM)
Last CommonJS version
6.5.0
Native ESM since
6.5.0
TypeScript types
Bundled
Node engines
>=12.0.0
Weekly downloads
161.3M
License
MIT

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.

Runtimerequire("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).

VersionsFormatFirst published
6.5.0Dual (CommonJS + ESM)Aug 14, 2025
1.0.0 – 6.4.6CommonJSMar 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

Similar popularity