Skip to content

feat!: require Node 24 and migrate CJS to ESM output#3045

Open
bennypowers wants to merge 1 commit intonode24/test-migrationfrom
node24/esm-and-node24
Open

feat!: require Node 24 and migrate CJS to ESM output#3045
bennypowers wants to merge 1 commit intonode24/test-migrationfrom
node24/esm-and-node24

Conversation

@bennypowers
Copy link
Member

Summary

BREAKING CHANGE: Node 24+ is now required. All packages emit ESM output.

  • Add "type": "module" to all package.json files (~38 packages)
  • Update exports to use single "default" condition (remove CJS/ESM dual exports)
  • Update engines to require node >=24.0.0
  • Delete 34 index.mjs shim files (no longer needed with native ESM)
  • Fix CJS interop issues:
    • require.resolve()import.meta.resolve() / createRequire()
    • __dirnameimport.meta.dirname
    • Default import interop for CJS packages (rollup plugins, saucelabs, internal-ip, portfinder)
  • Add .nvmrc (v24.11.1)

This is PR 3 of 4 in the Node 24 migration stack.

Stack

  1. node24/typescript-upgrade — TypeScript upgrade + .ts imports (chore: upgrade TypeScript to 5.9.3 and enable .ts imports #3043)
  2. node24/test-migration — mocha/chai → node:test migration (chore: migrate tests from mocha/chai to node:test #3044)
  3. This PR — CJS→ESM + Node 24 requirement
  4. node24/parse5-and-jsdoc — parse5 v8 + JSDoc→TS conversions

Test plan

  • npm run build passes with zero TS errors
  • Build output verified as ESM (export/import syntax)
  • CI passes

🤖 Generated with Claude Code

@changeset-bot
Copy link

changeset-bot bot commented Mar 17, 2026

🦋 Changeset detected

Latest commit: 18a0066

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

BREAKING CHANGE: Node 24+ is now required. All packages emit ESM.

- Add "type": "module" to all package.json files
- Update exports to use single "default" condition (remove CJS/ESM dual exports)
- Update engines to require Node >=24.0.0
- Delete all index.mjs shim files (34 files)
- Fix CJS interop issues across source files:
  - require.resolve → import.meta.resolve / createRequire
  - __dirname → import.meta.dirname
  - Default import interop for CJS packages (rollup plugins, saucelabs, etc.)
- Add .nvmrc (v24.11.1)
- Add changeset for breaking node version requirement

Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@bennypowers bennypowers force-pushed the node24/esm-and-node24 branch from f8015fd to 18a0066 Compare March 17, 2026 12:53
@bennypowers bennypowers force-pushed the node24/test-migration branch from 010ef78 to 8bd2017 Compare March 17, 2026 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant