Skip to content

Commit 73c7ca1

Browse files
committed
fixup! esm: bypass CJS loader in default load under --default-type=module
1 parent ec83ea9 commit 73c7ca1

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

doc/api/module.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -605,18 +605,17 @@ not possible to replace the value of a Node.js builtin (core) module.
605605
606606
Omitting vs providing a `source` for `'commonjs'` has very different effects:
607607
608-
* When a `source` is provided, or when running `node` with
609-
`--experimental-default-type=module`, all `require` calls from this module
610-
will be processed by the ESM loader with registered `resolve` and `load`
611-
hooks; all `require.resolve` calls from this module will be processed by the
612-
ESM loader with registered `resolve` hooks; only a subset of the CommonJS API
613-
will be available (e.g. no `require.extensions`, no `require.cache`, no
608+
* When a `source` is provided, all `require` calls from this module will be
609+
processed by the ESM loader with registered `resolve` and `load` hooks; all
610+
`require.resolve` calls from this module will be processed by the ESM loader
611+
with registered `resolve` hooks; only a subset of the CommonJS API will be
612+
available (e.g. no `require.extensions`, no `require.cache`, no
614613
`require.resolve.paths`) and monkey-patching on the CommonJS module loader
615614
will not apply.
616-
* If `source` is undefined or `null`, and `node` is run with
617-
`--experimental-default-type=commonjs`, it will be handled by the CommonJS
618-
module loader and `require`/`require.resolve` calls will not go through the
619-
registered hooks.
615+
* If `source` is undefined or `null`, it will be handled by the CommonJS module
616+
loader and `require`/`require.resolve` calls will not go through the
617+
registered hooks. This behavior for nullish `source` is temporary — in the
618+
future, nullish `source` will not be supported.
620619
621620
When `node` is run with `--experimental-default-type=commonjs`, the Node.js
622621
internal `load` implementation, which is the value of `next` for the

0 commit comments

Comments
 (0)