Skip to content

Commit

Permalink
chore: add the module-sync exports condition
Browse files Browse the repository at this point in the history
This allows users of Node.js v22.10 and above to import the ESM version
of the package using `require`.
See https://nodejs.org/en/blog/release/v22.10.0#new-module-sync-exports-condition
This avoids the issues of dual-package hazard.
  • Loading branch information
Conaclos committed Oct 17, 2024
1 parent 4c770e9 commit e7b810a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ New entries must be placed in a section entitled `Unreleased`.
This allows us to use the built-in Node.js CLI parser and then to remove the [Commander.js](https://www.npmjs.com/package/commander) dependency.
This reduces the standalone binary size from 77KB to 45KB (42%).

- Support `require(esm)` in Node.js v22.10 and above

This package now has the [new exports condition `module-sync`](https://nodejs.org/en/blog/release/v22.10.0#new-module-sync-exports-condition).
This allows users of Node.js v22.10 and above to import the ESM version of the package using `require`.
This avoids the issues of [dual-package hazard](https://nodejs.org/api/packages.html#dual-package-hazard).

## 0.15.0 (2023-10-19)

- BREAKING CHANGES: require Node.js 16.9.0 or above
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"./package.json": "./package.json",
".": {
"module": "./dist/index.js",
"module-sync": "./dist/index.js",
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
Expand Down

0 comments on commit e7b810a

Please sign in to comment.