mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
doc: clarify require(esm) description
PR-URL: https://github.com/nodejs/node/pull/60520 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
This commit is contained in:
1 parent
0b9ef68705
commit
62889d7e99
1 file changed
+2
-3
+2
-3
@@ -255,9 +255,8 @@ This property is experimental and can change in the future. It should only be us
|
||||
by tools converting ES modules into CommonJS modules, following existing ecosystem
|
||||
conventions. Code authored directly in CommonJS should avoid depending on it.
|
||||
|
||||
When an ES Module contains both named exports and a default export, the result returned by `require()`
|
||||
is the [module namespace object][], which places the default export in the `.default` property, similar to
|
||||
the results returned by `import()`.
|
||||
The result returned by `require()` is the [module namespace object][], which places
|
||||
the default export in the `.default` property, similar to the results returned by `import()`.
|
||||
To customize what should be returned by `require(esm)` directly, the ES Module can export the
|
||||
desired value using the string name `"module.exports"`.
|
||||
|
||||
|
||||
Reference in new issue
Block a user