Skip to content

module: support 'module.exports' interop export name in require(esm)#54563

Closed
guybedford wants to merge 1 commit into
nodejs:mainfrom
guybedford:cjs-unwrap
Closed

module: support 'module.exports' interop export name in require(esm)#54563
guybedford wants to merge 1 commit into
nodejs:mainfrom
guybedford:cjs-unwrap

Conversation

@guybedford
Copy link
Copy Markdown
Contributor

@guybedford guybedford commented Aug 26, 2024

This adds support for export { foo as 'module.exports' } in a CJS module to imply that this export value should always be used as the module value when requiring that ESM module under require(esm), allowing other types than just module namespaces in this interop.

This effectively splits off the non-major change from #53848 as discussed in the Node.js loaders meeting, under a rename of this flag to use the 'module.exports' pattern, where that PR will be updated to use the name that lands here on the ESM wrapper as a major change further.

The naming bikeshed took place in nodejs/loaders#221 and was determined by TSC vote.

//cc @nodejs/loaders

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backported-to-v22.x PRs backported to the v22.x-staging branch. loaders Issues and PRs related to ES module loaders module Issues and PRs related to the module subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants