Skip to content

Commit 3c6954c

Browse files
committed
chore: add the module-sync exports condition
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.
1 parent c81fd77 commit 3c6954c

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ New entries must be placed in a section entitled `Unreleased`.
1313
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.
1414
This reduces the standalone binary size from 77KB to 45KB (42%).
1515

16+
- Support `require(esm)` in Node.js v22.10 and above
17+
18+
This package now has the [new exports condition `module-sync`](https://nodejs.org/en/blog/release/v22.10.0#new-module-sync-exports-condition).
19+
This allows users of Node.js v22.10 and above to import the ESM version of the package using `require`.
20+
This avoids the issues of [dual-package hazard](https://nodejs.org/api/packages.html#dual-package-hazard).
21+
1622
## 0.15.0 (2023-10-19)
1723

1824
- BREAKING CHANGES: require Node.js 16.9.0 or above

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"./package.json": "./package.json",
3636
".": {
3737
"module": "./dist/index.js",
38+
"module-sync": "./dist/index.js",
3839
"require": {
3940
"types": "./dist/index.d.cts",
4041
"default": "./dist/index.cjs"

0 commit comments

Comments
 (0)