Skip to content

Commit 8e9e3d6

Browse files
divybotlittledivy
andcommitted
docs(node): document module-sync export condition
Co-Authored-By: Divy Srivastava <me@littledivy.com>
1 parent e669494 commit 8e9e3d6

1 file changed

Lines changed: 21 additions & 4 deletions

File tree

runtime/fundamentals/node.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -429,19 +429,36 @@ resolution mode. The conditions satisfied by an import from a Deno ESM module
429429
are as follows:
430430
431431
```json
432-
["deno", "node", "import", "default"]
432+
["deno", "node", "import", "module-sync", "default"]
433433
```
434434
435435
This means that the first condition listed in a package export whose key equals
436-
any of these strings will be matched. You can expand this list using the
437-
`--conditions` CLI flag:
436+
any of these strings will be matched. For `require()` resolution, including
437+
`createRequire()`, the conditions are:
438+
439+
```json
440+
["require", "node", "module-sync", "default"]
441+
```
442+
443+
Deno also applies `module-sync` when analyzing CommonJS modules that re-export
444+
through `require()`.
445+
446+
You can expand the import conditions list using the `--conditions` CLI flag:
438447
439448
```shell
440449
deno run --conditions development,react-server main.ts
441450
```
442451
443452
```json
444-
["development", "react-server", "deno", "node", "import", "default"]
453+
[
454+
"development",
455+
"react-server",
456+
"deno",
457+
"node",
458+
"import",
459+
"module-sync",
460+
"default"
461+
]
445462
```
446463
447464
## Importing types

0 commit comments

Comments
 (0)