canirequire › Dual (CommonJS + ESM) › file-entry-cache
Is file-entry-cache ESM-only? Can you require() it?
A lightweight cache for file metadata, ideal for processes that work on a specific set of files and only need to reprocess files that have changed since the last run
Last verified Sep 9, 2026 against file-entry-cache@11.1.5. Markdown · JSON
Dual (CommonJS + ESM) Dual package — require() works on every Node.js version we test; import works too
file-entry-cache publishes both a CommonJS entry and a native ESM entry (ESM added in 10.0.0). require("file-entry-cache") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. import "file-entry-cache" works alongside it.
What to do
- Nothing to change. require("file-entry-cache") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. import * as fileEntryCache from "file-entry-cache" works alongside it; use named imports for what the ESM entry exports.
- TypeScript: types are bundled; install nothing extra.
Does file-entry-cache@11.1.5 actually load? Runtime test results
Installed and executed on Sep 9, 2026 with require("file-entry-cache") from a CommonJS file and import "file-entry-cache" from an ES module.
| Runtime | require("file-entry-cache") | import "file-entry-cache" |
|---|---|---|
| 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 file-entry-cache
ES modules (import)
import * as fileEntryCache from "file-entry-cache";Namespace import shown because the ESM entry may have no default export; use named imports for what it exports.
CommonJS (require)
const fileEntryCache = require("file-entry-cache");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 (39 versions; the newest 39 shown).
| Versions | Format | First published |
|---|---|---|
| 10.0.0 – 11.1.5 | Dual (CommonJS + ESM) | Oct 4, 2024 |
| 1.0.0 – 9.1.0 | CommonJS | Mar 2, 2015 |
Frequently asked
Is file-entry-cache ESM-only?
file-entry-cache@11.1.5 ships CommonJS and ESM builds. file-entry-cache publishes both a CommonJS entry and a native ESM entry (ESM added in 10.0.0). require("file-entry-cache") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. import "file-entry-cache" works alongside it.
Can I require file-entry-cache?
Yes. file-entry-cache ships a CommonJS entry alongside the native ESM entry. require("file-entry-cache") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun.
Does file-entry-cache work in Bun?
Yes. import "file-entry-cache" loaded successfully in Bun 1.4.0 on Sep 9, 2026.
Does file-entry-cache ship TypeScript types?
Yes. file-entry-cache 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
- mime 4.1.0ESM-only
- flatted 3.4.4Dual
- call-bound 1.0.4CommonJS
- fast-glob 3.3.3CommonJS
- uri-js 4.4.1CommonJS
- @babel/runtime 8.0.0Dual
- encodeurl 2.0.0CommonJS
- import-fresh 4.0.0ESM-only