canirequire

canirequireCommonJS › fast-glob

Is fast-glob ESM-only? Can you require() it?

It's a very fast and efficient glob library for Node.js

Last verified Sep 9, 2026 against fast-glob@3.3.3. JSON

CommonJS CommonJS — require() works on every Node.js version

fast-glob ships CommonJS only. require("fast-glob") works everywhere. import "fast-glob" also works because Node.js and Bun can import CommonJS from ES modules, but only the default export is guaranteed; named imports depend on Node's static analysis of the module.

Latest
3.3.3 (Jan 5, 2025)
Module format
CommonJS
Last CommonJS version
3.3.3
TypeScript types
Bundled
Node engines
>=8.6.0
Weekly downloads
135.1M
License
MIT

Does fast-glob@3.3.3 actually load? Runtime test results

Installed and executed on Sep 9, 2026 with require("fast-glob") from a CommonJS file and import "fast-glob" from an ES module.

Runtimerequire("fast-glob")import "fast-glob"
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 fast-glob

ES modules (import)

import fastGlob from "fast-glob";

Named imports from a CommonJS package only work when Node.js can statically detect them. If a named import fails, use the default import and destructure.

CommonJS (require)

const fastGlob = require("fast-glob");

Module format by version

Derived from the type, main and exports fields of every stable release on npm (40 versions; the newest 40 shown).

VersionsFormatFirst published
1.0.0 – 3.3.3CommonJSDec 28, 2016

Frequently asked

Is fast-glob ESM-only?

fast-glob@3.3.3 is a CommonJS package. fast-glob ships CommonJS only. require("fast-glob") works everywhere. import "fast-glob" also works because Node.js and Bun can import CommonJS from ES modules, but only the default export is guaranteed; named imports depend on Node's static analysis of the module.

Can I import fast-glob with ES module syntax?

Yes. import fastGlob from "fast-glob" works in Node.js and Bun because they support importing CommonJS modules. Named imports work only when Node.js can statically detect the exports.

Does fast-glob work in Bun?

Yes. import "fast-glob" loaded successfully in Bun 1.4 on Sep 9, 2026.

Does fast-glob ship TypeScript types?

Yes. fast-glob bundles its own type declarations; no @types package is needed.

Links

Other commonjs packages

Similar popularity