Skip to content

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

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

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: f0dce7c

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

@bennypowers bennypowers force-pushed the node24/esm-and-node24 branch from f2b5763 to f8015fd Compare March 17, 2026 11:52
@bennypowers bennypowers force-pushed the node24/test-migration branch from a38ded7 to 010ef78 Compare March 17, 2026 11:52
@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 2 times, most recently from 8bd2017 to 268a3ff Compare March 17, 2026 14:57
@bennypowers bennypowers force-pushed the node24/esm-and-node24 branch 2 times, most recently from a2a3658 to eb87c8d Compare March 17, 2026 16:48
@bennypowers bennypowers force-pushed the node24/test-migration branch from 268a3ff to 61bf92a Compare March 17, 2026 16:48
@bennypowers bennypowers force-pushed the node24/esm-and-node24 branch 2 times, most recently from b1a23e2 to b77e600 Compare March 17, 2026 18:02
@bennypowers bennypowers force-pushed the node24/test-migration branch from b5e6238 to 32ba55e Compare March 17, 2026 18:02
@bennypowers bennypowers marked this pull request as draft March 17, 2026 18:34
@bennypowers bennypowers force-pushed the node24/esm-and-node24 branch from b77e600 to 10e9722 Compare March 17, 2026 19:01
@bennypowers bennypowers force-pushed the node24/test-migration branch from 32ba55e to 5abe25a Compare March 17, 2026 19:01
@bennypowers bennypowers force-pushed the node24/esm-and-node24 branch from 10e9722 to d3acddd Compare March 18, 2026 12:08
@bennypowers bennypowers force-pushed the node24/test-migration branch 2 times, most recently from 4fb3367 to 4926432 Compare March 18, 2026 13:33
@bennypowers bennypowers force-pushed the node24/esm-and-node24 branch 2 times, most recently from 441c093 to e99e801 Compare March 18, 2026 14:47
@bennypowers bennypowers force-pushed the node24/test-migration branch 2 times, most recently from 6aab5fb to 1effc4f Compare March 18, 2026 14:58
@bennypowers bennypowers force-pushed the node24/esm-and-node24 branch from e99e801 to f9df49b Compare March 18, 2026 14:58
@bennypowers bennypowers force-pushed the node24/test-migration branch from 1effc4f to 74db169 Compare March 18, 2026 17:03
@bennypowers bennypowers force-pushed the node24/esm-and-node24 branch from f9df49b to 16c8d24 Compare March 18, 2026 17:03
@bennypowers bennypowers force-pushed the node24/test-migration branch from 74db169 to 2c9b144 Compare March 19, 2026 06:13
@bennypowers bennypowers force-pushed the node24/esm-and-node24 branch 2 times, most recently from e8cf07b to e4d58b4 Compare March 19, 2026 07:07
@bennypowers bennypowers force-pushed the node24/test-migration branch from 2c9b144 to 6de56b9 Compare March 19, 2026 07:07
@bennypowers bennypowers force-pushed the node24/esm-and-node24 branch from e4d58b4 to 20d4ea5 Compare March 19, 2026 07:52
@bennypowers bennypowers force-pushed the node24/test-migration branch 2 times, most recently from 154f6c6 to b5742ef Compare March 19, 2026 09:19
@bennypowers bennypowers force-pushed the node24/esm-and-node24 branch 2 times, most recently from 7f9a2d9 to 9665829 Compare March 19, 2026 11:28
@bennypowers bennypowers force-pushed the node24/test-migration branch 2 times, most recently from 2561d7b to bd8352e Compare March 19, 2026 11:47
@bennypowers bennypowers force-pushed the node24/esm-and-node24 branch from 9665829 to 68e0a42 Compare March 19, 2026 11:47
@bennypowers bennypowers force-pushed the node24/test-migration branch from bd8352e to 3310feb Compare March 19, 2026 12:01
@bennypowers bennypowers force-pushed the node24/esm-and-node24 branch from 68e0a42 to 9a44cdd Compare March 19, 2026 12:01
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 9a44cdd to f0dce7c Compare March 19, 2026 12:56
@bennypowers bennypowers force-pushed the node24/test-migration branch from 3310feb to 601a57f Compare March 19, 2026 12:56
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