Skip to content

doc: module: Conditional exports docs for writing dual packages

This PR is an addendum to @guybedford’s https://github.com/nodejs/node/pull/29978. This adds documentation to explain what the divergent specifier hazard is and provide two approaches for preventing or avoiding it when writing dual CommonJS/ES module packages. This came out of discussion in https://github.com/nodejs/modules/issues/371 including some suggestions from @coreyfarrell. cc @MylesBorins.

This PR includes the other one, so please focus on esm.md starting at the “Dual CommonJS/ES Module Packages” heading: https://github.com/nodejs/node/pull/30051/files?short_path=8e67f40#diff-8e67f407bc32a0569e25d7ecaff6e494

Checklist

Merge request reports

Loading