Skip to content

Commit 4c062bd

Browse files
committed
docs: mention module-sync condition
1 parent d9cd3e4 commit 4c062bd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/pages/esm.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,11 @@ For example, here is a setup that uses ESM for Webpack, Vite, Rollup, Metro (Rea
202202
"types": "./lib/typescript/module/src/index.d.ts",
203203
"default": "./lib/module/index.js"
204204
},
205-
"node": {
205+
"module": {
206206
"types": "./lib/typescript/module/src/index.d.ts",
207207
"default": "./lib/module/index.js"
208208
},
209-
"module": {
209+
"module-sync": {
210210
"types": "./lib/typescript/module/src/index.d.ts",
211211
"default": "./lib/module/index.js"
212212
},
@@ -223,8 +223,8 @@ For example, here is a setup that uses ESM for Webpack, Vite, Rollup, Metro (Rea
223223
Here, we specify 4 conditions:
224224

225225
- `react-native`: Used when the library is imported in a React Native environment with Metro.
226-
- `node`: Used when the library is imported in Node.js.
227-
- `module`: Used when the library is imported in a bundler such as Webpack, Vite or Rollup.
226+
- `module`: Used when the library is imported in some bundler ssuch as Webpack, Vite or Rollup.
227+
- `module-sync`: Used when the library is imported on Node.js 22.10.0+ - regardless of whether it's imported with `import` or `require`.
228228
- `default`: Fallback used when the library is imported in an environment that doesn't support the other conditions.
229229

230230
One thing to note is that TypeScript may need to be configured to resolve to the appropriate condition. It's pre-configured for React Native apps, but in other scenarios, it maybe necessary to specify [`customConditions`](https://www.typescriptlang.org/tsconfig/#customConditions) in the `tsconfig.json` file:

0 commit comments

Comments
 (0)