canirequire

canirequire › ESM-only › @antfu/eslint-config

Is @antfu/eslint-config ESM-only? Can you require() it?

Anthony's ESLint config

Last verified Sep 9, 2026 against @antfu/eslint-config@9.5.1. Markdown · JSON

ESM-only ESM-only since 4.0.0 — last CommonJS version is 3.16.0

@antfu/eslint-config dropped its CommonJS build in 4.0.0 (January 2025). The last version with a plain require()-able CommonJS entry is 3.16.0, published Jan 22, 2025.

require("@antfu/eslint-config") 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("@antfu/eslint-config") fails with ERR_REQUIRE_ESM.

What to do

  1. require("@antfu/eslint-config") failed in our probe on Node.js 20+ as well; see the runtime table for the error before relying on it.
  2. From a CommonJS file, use a dynamic import inside an async function: const eslintConfig = await import("@antfu/eslint-config"). That works on every Node.js version the package supports.
  3. If you need a synchronous require() or run Node.js 18: npm install @antfu/eslint-config@3.16.0, the last CommonJS release (published Jan 22, 2025).
  4. TypeScript: types are bundled; install nothing extra.
Latest
9.5.1 (Sep 2, 2026)
Module format
ESM-only
Last CommonJS version
3.16.0
ESM-only since
4.0.0 (Jan 25, 2025)
TypeScript types
Bundled
Node engines
not declared
Weekly downloads
448K
License
MIT

Does @antfu/eslint-config@9.5.1 actually load? Runtime test results

Installed and executed on Sep 9, 2026 with require("@antfu/eslint-config") from a CommonJS file and import "@antfu/eslint-config" from an ES module.

Runtimerequire("@antfu/eslint-config")import "@antfu/eslint-config"
Node.js 18✗ failsERR_REQUIRE_ESM✗ failsSyntaxError
Node.js 20✗ failsTypeError✗ failsTypeError
Node.js 22✓ works✓ works
Node.js 24✓ works✓ works
Node.js 26✓ works✓ works
Bun 1.4.0✓ works✓ works

How to import @antfu/eslint-config

ES modules (import)

import * as eslintConfig from "@antfu/eslint-config";

Namespace import shown because the ESM entry may have no default export; use named imports for what it exports.

CommonJS (require)

// require("@antfu/eslint-config") failed in our probe on Node.js 20.19+, 22.12+ and newer as well; see the runtime table.

// Any Node.js version the package supports, from an async function:
async function main() {
  const eslintConfig = await import("@antfu/eslint-config");
}

// Or pin the last CommonJS release:
// npm install @antfu/eslint-config@3.16.0

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 (348 versions; the newest 60 shown).

VersionsFormatFirst published
4.13.3 – 9.5.1ESM-onlyJun 4, 2025

Frequently asked

Is @antfu/eslint-config ESM-only?

@antfu/eslint-config@9.5.1 is ESM-only. @antfu/eslint-config dropped its CommonJS build in 4.0.0 (January 2025). The last version with a plain require()-able CommonJS entry is 3.16.0, published Jan 22, 2025.

Which version of @antfu/eslint-config still supports CommonJS / require()?

3.16.0 is the last version of @antfu/eslint-config with a CommonJS build. Install it with "npm install @antfu/eslint-config@3.16.0". Every version from 4.0.0 on is ESM-only.

How do I use @antfu/eslint-config from a CommonJS file?

From a CommonJS file, use a dynamic import inside an async function: const eslintConfig = await import("@antfu/eslint-config"). That works on every Node.js version the package supports. require("@antfu/eslint-config") failed in our probe on Node.js 20+ as well; see the runtime table for the error before relying on it. Alternatively pin @antfu/eslint-config@3.16.0.

Does @antfu/eslint-config work in Bun?

Yes. import "@antfu/eslint-config" loaded successfully in Bun 1.4.0 on Sep 9, 2026.

Does @antfu/eslint-config ship TypeScript types?

Yes. @antfu/eslint-config bundles its own type declarations; no @types package is needed.

Links

Other esm-only packages

Similar popularity