canirequire › ESM-only › @humanfs/core
Is @humanfs/core ESM-only? Can you require() it?
The core of the humanfs library.
Last verified Sep 9, 2026 against @humanfs/core@0.19.2. Markdown · JSON
ESM-only ESM-only — it has never shipped a CommonJS build
@humanfs/core has been ESM-only since its first stable release; there is no CommonJS version to pin.
require("@humanfs/core") failed in our probe on Node.js 20+ as well; see the runtime table for the error before relying on it. On Node.js 18, which has no require(esm), require("@humanfs/core") fails with ERR_REQUIRE_ESM.
What to do
- require("@humanfs/core") failed in our probe on Node.js 20+ as well; see the runtime table for the error before relying on it.
- From a CommonJS file, use a dynamic import inside an async function: const core = await import("@humanfs/core"). That works on every Node.js version the package supports (>=18.18.0).
- There is no CommonJS release of @humanfs/core to pin; without require(esm) the only option is a dynamic import().
- TypeScript: types are bundled; install nothing extra.
Does @humanfs/core@0.19.2 actually load? Runtime test results
Installed and executed on Sep 9, 2026 with require("@humanfs/core") from a CommonJS file and import "@humanfs/core" from an ES module.
| Runtime | require("@humanfs/core") | import "@humanfs/core" |
|---|---|---|
| Node.js 18 | ✗ failsERR_PACKAGE_PATH_NOT_EXPORTED | ✓ works |
| Node.js 20 | ✗ failsERR_PACKAGE_PATH_NOT_EXPORTED | ✓ works |
| Node.js 22 | ✗ failsERR_PACKAGE_PATH_NOT_EXPORTED | ✓ works |
| Node.js 24 | ✗ failsERR_PACKAGE_PATH_NOT_EXPORTED | ✓ works |
| Node.js 26 | ✗ failsERR_PACKAGE_PATH_NOT_EXPORTED | ✓ works |
| Bun 1.4.0 | ✗ failsError | ✓ works |
How to import @humanfs/core
ES modules (import)
import * as core from "@humanfs/core";Namespace import shown because the ESM entry may have no default export; use named imports for what it exports.
CommonJS (require)
// require("@humanfs/core") failed in our probe on Node.js 20.19+, 22.12+ and newer as well (ERR_PACKAGE_PATH_NOT_EXPORTED); see the runtime table.
// Any Node.js version the package supports (>=18.18.0), from an async function:
async function main() {
const core = await import("@humanfs/core");
}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 (19 versions; the newest 19 shown).
| Versions | Format | First published |
|---|---|---|
| 0.6.0 – 0.19.2 | ESM-only | Jan 30, 2024 |
Frequently asked
Is @humanfs/core ESM-only?
@humanfs/core@0.19.2 is ESM-only. @humanfs/core has been ESM-only since its first stable release; there is no CommonJS version to pin.
Which version of @humanfs/core still supports CommonJS / require()?
None. @humanfs/core has always been ESM-only. Use import, or a dynamic import("@humanfs/core") from an async function in CommonJS.
How do I use @humanfs/core from a CommonJS file?
From a CommonJS file, use a dynamic import inside an async function: const core = await import("@humanfs/core"). That works on every Node.js version the package supports (>=18.18.0). require("@humanfs/core") failed in our probe on Node.js 20+ as well; see the runtime table for the error before relying on it.
Does @humanfs/core work in Bun?
Yes. import "@humanfs/core" loaded successfully in Bun 1.4.0 on Sep 9, 2026.
Does @humanfs/core ship TypeScript types?
Yes. @humanfs/core bundles its own type declarations; no @types package is needed.
Links
Other esm-only packages
- ansi-styles 7.0.0last CJS
5.2.0 - strip-ansi 7.2.0last CJS
6.0.1 - commander 15.0.0last CJS
14.0.3 - supports-color 11.0.0last CJS
8.1.1 - chalk 6.0.0last CJS
4.1.2 - string-width 8.2.2last CJS
4.2.3 - ansi-regex 6.3.0last CJS
5.0.1 - escape-string-regexp 5.0.0last CJS
4.0.0
Similar popularity
- fast-xml-parser 5.11.1Dual
- @aws-sdk/xml-builder 3.972.40CommonJS
- normalize-package-data 9.0.0CommonJS
- @aws-sdk/nested-clients 3.997.44Dual
- leven 4.1.0ESM-only
- unist-util-is 6.0.1ESM-only
- typed-array-byte-offset 1.0.4CommonJS
- lz-string 1.5.0CommonJS