Skip to content

fix: preserve CJS bridge JSON requires#799

Open
oritwoen wants to merge 1 commit into
privatenumber:masterfrom
oritwoen:fix-yarn-pnp-cjs-json-require
Open

fix: preserve CJS bridge JSON requires#799
oritwoen wants to merge 1 commit into
privatenumber:masterfrom
oritwoen:fix-yarn-pnp-cjs-json-require

Conversation

@oritwoen

Copy link
Copy Markdown

Fixes #797.

Yarn PnP hits a weird Node edge here: CJS require() for JSON goes through the sync ESM hook with import conditions. tsx was treating that as ESM JSON and breaking the CJS side.

Kept that bridge path as raw JSON and added regression coverage. Real Node bug is still nodejs/node#51327 - this is just the guard tsx can land.

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.

Weird interaction between CJS and ESM for JSON modules, when using yarn

1 participant