canirequire

canirequireESM-only › commitlint

Is commitlint ESM-only? Can you require() it?

Lint your commit messages

Last verified Sep 9, 2026 against commitlint@21.2.2. JSON

ESM-only ESM-only since 19.0.0 — last CommonJS version is 18.6.1

commitlint dropped its CommonJS build in 19.0.0 (February 2024). The last version you can require() on every Node.js version, including 18 and older, is 18.6.1, published Feb 13, 2024.

require("commitlint") failed in our probe on Node.js 20+ as well. See the runtime matrix below for the exact error.

commitlint@21.2.2 declares engines ">=22.12.0", so Node.js 18, 20 are outside its supported range regardless of module format.

Latest
21.2.2 (Aug 13, 2026)
Module format
ESM-only
Last CommonJS version
18.6.1
ESM-only since
19.0.0 (Feb 27, 2024)
TypeScript types
None
Node engines
>=22.12.0
Weekly downloads
523K
License
MIT

Does commitlint@21.2.2 actually load? Runtime test results

Installed and executed on Sep 9, 2026 with require("commitlint") from a CommonJS file and import "commitlint" from an ES module.

Runtimerequire("commitlint")import "commitlint"
Node.js 18✗ failsMODULE_NOT_FOUND✗ failsERR_MODULE_NOT_FOUND
Node.js 20✗ failsMODULE_NOT_FOUND✗ failsERR_MODULE_NOT_FOUND
Node.js 22✗ failsMODULE_NOT_FOUND✗ failsERR_MODULE_NOT_FOUND
Node.js 24✗ failsMODULE_NOT_FOUND✗ failsERR_MODULE_NOT_FOUND
Node.js 26✗ failsMODULE_NOT_FOUND✗ failsERR_MODULE_NOT_FOUND
Bun 1.4✗ failserror: Cannot find package 'commitlint' from '/Users/boat/Projects/top-seo/data/probe-work/commitlint/req.cjs'✗ failserror: Cannot find package 'commitlint' from '/Users/boat/Projects/top-seo/data/probe-work/commitlint/imp.mjs'

How to import commitlint

ES modules (import)

import commitlint from "commitlint";

CommonJS (require)

// Node.js 20.19+ / 22.12+ / newer (package has no top-level await):
const commitlint = require("commitlint");

// Any Node.js version:
const commitlint = await import("commitlint");

// Or pin the last CommonJS release:
// npm install commitlint@18.6.1

Module format by version

Derived from the type, main and exports fields of every stable release on npm (148 versions; the newest 60 shown).

VersionsFormatFirst published
19.0.0 – 21.2.2ESM-onlyFeb 27, 2024
17.5.1 – 18.6.1CommonJSMar 28, 2023

Frequently asked

Is commitlint ESM-only?

commitlint@21.2.2 is ESM-only. commitlint dropped its CommonJS build in 19.0.0 (February 2024). The last version you can require() on every Node.js version, including 18 and older, is 18.6.1, published Feb 13, 2024.

Which version of commitlint still supports CommonJS / require()?

18.6.1 is the last version of commitlint with a CommonJS build. Install it with "npm install commitlint@18.6.1". Every version from 19.0.0 on is ESM-only.

How do I use commitlint from a CommonJS file?

Use a dynamic import: const mod = await import("commitlint"). On Node.js 20.19+, 22.12+ and newer, a plain require("commitlint") also works for ESM packages that do not use top-level await. Alternatively pin commitlint@18.6.1.

Does commitlint work in Bun?

Importing commitlint failed in Bun 1.4 on Sep 9, 2026: error: Cannot find package 'commitlint' from '/Users/boat/Projects/top-seo/data/probe-work/commitlint/imp.mjs'

Does commitlint ship TypeScript types?

No. commitlint ships no type declarations and there is no @types package for it.

Links

Other esm-only packages

Similar popularity