canirequire

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

  1. 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.
  2. 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).
  3. 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.
  4. @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.
  5. TypeScript: types are bundled; install nothing extra.
Latest
21.2.2 (Aug 13, 2026)
Module format
ESM-only
Last CommonJS version
18.6.3
ESM-only since
19.0.0 (Feb 27, 2024)
TypeScript types
Bundled
Node engines
>=22.12.0
Weekly downloads
9.0M
License
MIT

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.

Runtimerequire("@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.3

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

VersionsFormatFirst published
19.0.0 – 21.2.2ESM-onlyFeb 27, 2024
18.6.2 – 18.6.3Dual (CommonJS + ESM)Feb 14, 2024
16.0.0 – 18.6.1CommonJSDec 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

Similar popularity