canirequire › ESM-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.
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.
| Runtime | require("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.1Module format by version
Derived from the type, main and exports fields of every stable release on npm (148 versions; the newest 60 shown).
| Versions | Format | First published |
|---|---|---|
| 19.0.0 – 21.2.2 | ESM-only | Feb 27, 2024 |
| 17.5.1 – 18.6.1 | CommonJS | Mar 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
- 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 - tslib 2.8.1last CJS
2.5.2 - string-width 8.2.2last CJS
4.2.3 - ansi-regex 6.3.0last CJS
5.0.1
Similar popularity
- gh-pages 6.3.0CommonJS
- jsdom-global 3.0.2CommonJS
- rollup-plugin-commonjs 10.1.0CommonJS
- eslint-plugin-babel 5.3.1CommonJS
- angular 1.8.3CommonJS
- uglifyjs-webpack-plugin 2.2.0CommonJS
- babel-plugin-lodash 3.3.4CommonJS
- babel-preset-react 6.24.1CommonJS