canirequire

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

  1. 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.
  2. 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).
  3. 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).
  4. @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.
  5. TypeScript: no types are available for @changesets/cli; declare the module yourself if you need them.
Latest
3.0.2 (Sep 4, 2026)
Module format
ESM-only
Last CommonJS version
2.31.1
ESM-only since
3.0.0 (Aug 11, 2026)
TypeScript types
None
Node engines
^22.11 || ^24 || >=26
Weekly downloads
3.4M
License
MIT

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.

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

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

VersionsFormatFirst published
3.0.0 – 3.0.2ESM-onlyAug 11, 2026
2.27.0 – 2.31.1Dual (CommonJS + ESM)Nov 28, 2023
2.11.2 – 2.26.2CommonJSOct 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

Similar popularity