feat!: require Node 24 and migrate CJS to ESM output#3045
Draft
bennypowers wants to merge 7 commits intonode24/test-migrationfrom
Draft
feat!: require Node 24 and migrate CJS to ESM output#3045bennypowers wants to merge 7 commits intonode24/test-migrationfrom
bennypowers wants to merge 7 commits intonode24/test-migrationfrom
Conversation
🦋 Changeset detectedLatest commit: dec9658 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 |
3 tasks
f2b5763 to
f8015fd
Compare
a38ded7 to
010ef78
Compare
f8015fd to
18a0066
Compare
8bd2017 to
268a3ff
Compare
a2a3658 to
eb87c8d
Compare
268a3ff to
61bf92a
Compare
b1a23e2 to
b77e600
Compare
b5e6238 to
32ba55e
Compare
b77e600 to
10e9722
Compare
32ba55e to
5abe25a
Compare
10e9722 to
d3acddd
Compare
4fb3367 to
4926432
Compare
441c093 to
e99e801
Compare
6aab5fb to
1effc4f
Compare
e99e801 to
f9df49b
Compare
1effc4f to
74db169
Compare
f9df49b to
16c8d24
Compare
74db169 to
2c9b144
Compare
e8cf07b to
e4d58b4
Compare
2c9b144 to
6de56b9
Compare
4841973 to
0a62b2c
Compare
5549599 to
83a016b
Compare
0a62b2c to
badf76c
Compare
f92e889 to
fe5ef17
Compare
badf76c to
059908a
Compare
5 tasks
fe5ef17 to
fa00235
Compare
c40dc3e to
fdff965
Compare
fa00235 to
6152fa0
Compare
fdff965 to
037552b
Compare
6152fa0 to
853196c
Compare
037552b to
0c3de8d
Compare
1e7a44c to
3b0e109
Compare
49b4991 to
2cc8e4e
Compare
50f5b06 to
708a7ce
Compare
5 tasks
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>
- Restore parse5 to ^6.0.1 in all packages (v8 migration is PR4) - Add @ts-ignore for rollupPluginExternalGlobals usage sites - Regenerate package-lock.json Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Update all package.json exports to use "default" condition - Remove "module" field from packages (ESM via "type": "module") - Fix "main" field for packages with changed entry points - Keep JSDoc packages (parse5-utils, config-loader, rollup-plugin-copy, rollup-plugin-import-meta-assets, storybook-utils) WITHOUT "type": "module" since their .js source uses require() -- converted to ESM in PR4 - Restore parse5-utils index.mjs ESM wrapper with createRequire - Apply CJS interop fixes (import.meta.resolve, createRequire) for source files that used require.resolve/__dirname Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
JSDoc packages (config-loader, rollup-plugin-copy, rollup-plugin-import-meta-assets) have CJS source in src/, not compiled output in dist/. The exports map must point to src/ for runtime resolution to work. Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
browserScript.ts reads compiled serialize.js and logUncaughtErrors.js at runtime and injects them into the browser via page.evaluate(). With ESM output, these files have `export` keywords which are invalid in non-module browser script context. Strip them on read. Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The test reads dist/serialize.js directly and injects it into the browser via page.evaluate. Need to strip ESM export keyword there too, not just in browserScript.ts. Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
BREAKING CHANGE: Node 24+ is now required. All packages emit ESM output.
"type": "module"to all TypeScript package.json files(JSDoc packages remain CJS until PR4 converts them)
"default"condition"module"field (replaced by"type": "module")node >=24.0.0index.mjsshim files (no longer needed with native ESM)require.resolve()->import.meta.resolve()/createRequire()__dirname->import.meta.dirname.nvmrc(v24.11.1)This is PR 3 of 4 in the Node 24 migration stack.
Stack
node24/typescript-upgrade-- TypeScript upgrade +.tsimports (chore: upgrade TypeScript to 5.9.3 and enable .ts imports #3043)node24/test-migration-- mocha/chai to node:test migration (chore: migrate tests from mocha/chai to node:test #3044)node24/parse5-and-jsdoc-- parse5 v8 + JSDoc to TS conversions (feat!: migrate parse5 to v8 and convert JSDoc packages to TypeScript #3046)Test plan
npm run buildpasses with zero TS errorsexport/importsyntax)Generated with Claude Code