canirequire › ESM-only › @changesets/cli
Is @changesets/cli ESM-only? Can you require() it?
A tool to manage versioning and changelogs with a focus on monorepos
Last verified Sep 9, 2026 against @changesets/cli@3.0.2. Markdown · JSON
ESM-only ESM-only since 3.0.0 — last CommonJS version is 2.31.1
@changesets/cli dropped its CommonJS build in 3.0.0 (August 2026). The last version with a plain require()-able CommonJS entry is 2.31.1, published Jul 15, 2026.
require("@changesets/cli") fails even on Node.js 22.12+ and newer: the package uses top-level await, which require(esm) cannot load (ERR_REQUIRE_ASYNC_MODULE). Use import() instead. Node.js 18 has no require(esm), and @changesets/cli@3.0.2 declares Node.js ^22.11 || ^24 || >=26, so 18 is outside its supported range anyway.
@changesets/cli@3.0.2 declares engines "^22.11 || ^24 || >=26", so Node.js 18, 20 are outside its supported range regardless of module format.
What to do
- require("@changesets/cli") fails even on Node.js 22.12+ and newer: the package uses top-level await, which require(esm) cannot load (ERR_REQUIRE_ASYNC_MODULE). Use import() instead.
- From a CommonJS file, use a dynamic import inside an async function: const cli = await import("@changesets/cli"). That works on every Node.js version the package supports (^22.11 || ^24 || >=26).
- If you need a synchronous require() or run Node.js 18: npm install @changesets/cli@2.31.1, the last CommonJS release (published Jul 15, 2026).
- @changesets/cli@3.0.2 declares engines "^22.11 || ^24 || >=26", so Node.js 18, 20 are unsupported regardless: upgrade Node.js or pin an older release.
- TypeScript: no types are available for @changesets/cli; declare the module yourself if you need them.
Does @changesets/cli@3.0.2 actually load? Runtime test results
Installed and executed on Sep 9, 2026 with require("@changesets/cli") from a CommonJS file and import "@changesets/cli" from an ES module.
| Runtime | require("@changesets/cli") | import "@changesets/cli" |
|---|---|---|
| Node.js 18 | ✗ failsERR_REQUIRE_ESM | ✗ failsSyntaxError |
| Node.js 20 | ✗ failsERR_REQUIRE_ASYNC_MODULE | ✗ failsError |
| Node.js 22 | ✗ failsERR_REQUIRE_ASYNC_MODULE | ✗ failsError |
| Node.js 24 | ✗ failsERR_REQUIRE_ASYNC_MODULE | ✗ failsError |
| Node.js 26 | ✗ failsERR_REQUIRE_ASYNC_MODULE | ✗ failsError |
| Bun 1.4.0 | ✗ failsTypeError | ✗ failsError |
How to import @changesets/cli
ES modules (import)
import * as cli from "@changesets/cli";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 cannot require() this package: it uses top-level await.
// Any Node.js version the package supports (^22.11 || ^24 || >=26), from an async function:
async function main() {
const cli = await import("@changesets/cli");
}
// Or pin the last CommonJS release:
// npm install @changesets/cli@2.31.1Module 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 (109 versions; the newest 60 shown).
| Versions | Format | First published |
|---|---|---|
| 3.0.0 – 3.0.2 | ESM-only | Aug 11, 2026 |
| 2.27.0 – 2.31.1 | Dual (CommonJS + ESM) | Nov 28, 2023 |
| 2.11.2 – 2.26.2 | CommonJS | Oct 30, 2020 |
Frequently asked
Is @changesets/cli ESM-only?
@changesets/cli@3.0.2 is ESM-only. @changesets/cli dropped its CommonJS build in 3.0.0 (August 2026). The last version with a plain require()-able CommonJS entry is 2.31.1, published Jul 15, 2026.
Which version of @changesets/cli still supports CommonJS / require()?
2.31.1 is the last version of @changesets/cli with a CommonJS build. Install it with "npm install @changesets/cli@2.31.1". Every version from 3.0.0 on is ESM-only.
How do I use @changesets/cli from a CommonJS file?
From a CommonJS file, use a dynamic import inside an async function: const cli = await import("@changesets/cli"). That works on every Node.js version the package supports (^22.11 || ^24 || >=26). require("@changesets/cli") fails even on Node.js 22.12+ and newer: the package uses top-level await, which require(esm) cannot load (ERR_REQUIRE_ASYNC_MODULE). Use import() instead. Alternatively pin @changesets/cli@2.31.1.
Does @changesets/cli work in Bun?
Importing @changesets/cli failed in Bun 1.4.0 on Sep 9, 2026.
Does @changesets/cli ship TypeScript types?
No. @changesets/cli 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 - 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
- popper.js 1.16.1CommonJS
- @babel/cli 8.0.4No entry
- vite-plugin-dts 5.1.0Dual
- pug 3.0.4CommonJS
- webpack-manifest-plugin 6.0.1ESM-only
- rollup-plugin-terser 7.0.2Dual
- ethers 6.17.0Dual
- vue-i18n 11.4.10Dual