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
- 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.
- 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.
- 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).
- TypeScript: types are bundled; install nothing extra.
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.
| Runtime | require("@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.0Module 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).
| Versions | Format | First published |
|---|---|---|
| 4.13.3 – 9.5.1 | ESM-only | Jun 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
- 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
- karma-coverage-istanbul-reporter 3.0.3CommonJS
- grunt-contrib-watch 1.1.0CommonJS
- standard 17.1.2ESM-only
- ts-mocha 11.1.0CommonJS
- @vue/cli-plugin-router 5.0.9CommonJS
- @vue/cli-plugin-vuex 5.0.9CommonJS
- enzyme-adapter-react-16 1.15.8CommonJS
- ember-cli-htmlbars 7.0.1CommonJS