canirequire › ESM-only › @commitlint/config-conventional
Is @commitlint/config-conventional ESM-only? Can you require() it?
Shareable commitlint config enforcing conventional commits
Last verified Sep 9, 2026 against @commitlint/config-conventional@21.2.2. Markdown · JSON
ESM-only ESM-only since 19.0.0 — last CommonJS version is 18.6.3
@commitlint/config-conventional dropped its CommonJS build in 19.0.0 (February 2024). The last version with a plain require()-able CommonJS entry is 18.6.3, published Mar 11, 2024; it declares support for Node.js >=v18.
On Node.js 22.12+ and newer (@commitlint/config-conventional@21.2.2 declares Node.js >=22.12.0), require("@commitlint/config-conventional") works with the latest version: Node.js loads synchronous ES modules through require(). Verified on Node.js 22, 24 and 26. Node.js 18 has no require(esm), and @commitlint/config-conventional@21.2.2 declares Node.js >=22.12.0, so 18 is outside its supported range anyway.
@commitlint/config-conventional@21.2.2 declares engines ">=22.12.0", so Node.js 18, 20 are outside its supported range regardless of module format.
What to do
- On Node.js 22.12+ and newer (@commitlint/config-conventional@21.2.2 declares Node.js >=22.12.0), require("@commitlint/config-conventional") works with the latest version: Node.js loads synchronous ES modules through require(). Verified on Node.js 22, 24 and 26.
- From a CommonJS file, use a dynamic import inside an async function: const configConventional = await import("@commitlint/config-conventional"). That works on every Node.js version the package supports (>=22.12.0).
- If you need a synchronous require() or run Node.js 18: npm install @commitlint/config-conventional@18.6.3, the last CommonJS release (published Mar 11, 2024); it declares Node.js >=v18.
- @commitlint/config-conventional@21.2.2 declares engines ">=22.12.0", so Node.js 18, 20 are unsupported regardless: upgrade Node.js or pin an older release.
- TypeScript: types are bundled; install nothing extra.
Does @commitlint/config-conventional@21.2.2 actually load? Runtime test results
Installed and executed on Sep 9, 2026 with require("@commitlint/config-conventional") from a CommonJS file and import "@commitlint/config-conventional" from an ES module.
| Runtime | require("@commitlint/config-conventional") | import "@commitlint/config-conventional" |
|---|---|---|
| Node.js 18 | ✗ failsERR_REQUIRE_ESM | ✓ 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 @commitlint/config-conventional
ES modules (import)
import * as configConventional from "@commitlint/config-conventional";Namespace import shown because the ESM entry may have no default export; use named imports for what it exports.
CommonJS (require)
// Node.js 22.12+ and newer (verified):
const configConventional = require("@commitlint/config-conventional");
// Any Node.js version the package supports (>=22.12.0), from an async function:
async function main() {
const configConventional = await import("@commitlint/config-conventional");
}
// Or pin the last CommonJS release (declares Node.js >=v18):
// npm install @commitlint/config-conventional@18.6.3Module 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 (107 versions; the newest 60 shown).
| Versions | Format | First published |
|---|---|---|
| 19.0.0 – 21.2.2 | ESM-only | Feb 27, 2024 |
| 18.6.2 – 18.6.3 | Dual (CommonJS + ESM) | Feb 14, 2024 |
| 16.0.0 – 18.6.1 | CommonJS | Dec 26, 2021 |
Frequently asked
Is @commitlint/config-conventional ESM-only?
@commitlint/config-conventional@21.2.2 is ESM-only. @commitlint/config-conventional dropped its CommonJS build in 19.0.0 (February 2024). The last version with a plain require()-able CommonJS entry is 18.6.3, published Mar 11, 2024; it declares support for Node.js >=v18.
Which version of @commitlint/config-conventional still supports CommonJS / require()?
18.6.3 is the last version of @commitlint/config-conventional with a CommonJS build; it declares Node.js >=v18. Install it with "npm install @commitlint/config-conventional@18.6.3". Every version from 19.0.0 on is ESM-only.
How do I use @commitlint/config-conventional from a CommonJS file?
From a CommonJS file, use a dynamic import inside an async function: const configConventional = await import("@commitlint/config-conventional"). That works on every Node.js version the package supports (>=22.12.0). On Node.js 22.12+ and newer (@commitlint/config-conventional@21.2.2 declares Node.js >=22.12.0), require("@commitlint/config-conventional") works with the latest version: Node.js loads synchronous ES modules through require(). Verified on Node.js 22, 24 and 26. Alternatively pin @commitlint/config-conventional@18.6.3 (declares Node.js >=v18).
Does @commitlint/config-conventional work in Bun?
Yes. import "@commitlint/config-conventional" loaded successfully in Bun 1.4.0 on Sep 9, 2026.
Does @commitlint/config-conventional ship TypeScript types?
Yes. @commitlint/config-conventional 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
- styled-components 6.5.3CommonJS
- polished 4.3.1CommonJS
- firebase 12.18.0Dual
- @babel/plugin-proposal-nullish-coalescing-operator 7.18.6CommonJS
- xlsx 0.18.5CommonJS
- update-notifier 7.3.1ESM-only
- webpack-bundle-analyzer 5.3.2CommonJS
- @svgr/webpack 8.1.0CommonJS