Skip to content

Commit 0192a7d

Browse files
dario-piotrowiczjasnell
authored andcommitted
doc: add module namespace object links
PR-URL: #57093 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ulises Gascón <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent ef91595 commit 0192a7d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

doc/api/modules.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ regarding which files are parsed as ECMAScript modules.
209209
`"type": "commonjs"`, and the module contains ES module syntax.
210210

211211
If the ES Module being loaded meets the requirements, `require()` can load it and
212-
return the module namespace object. In this case it is similar to dynamic
212+
return the [module namespace object][]. In this case it is similar to dynamic
213213
`import()` but is run synchronously and returns the name space object
214214
directly.
215215

@@ -254,7 +254,7 @@ by tools converting ES modules into CommonJS modules, following existing ecosyst
254254
conventions. Code authored directly in CommonJS should avoid depending on it.
255255

256256
When an ES Module contains both named exports and a default export, the result returned by `require()`
257-
is the module namespace object, which places the default export in the `.default` property, similar to
257+
is the [module namespace object][], which places the default export in the `.default` property, similar to
258258
the results returned by `import()`.
259259
To customize what should be returned by `require(esm)` directly, the ES Module can export the
260260
desired value using the string name `"module.exports"`.
@@ -1301,6 +1301,7 @@ This section was moved to
13011301
[`process.features.require_module`]: process.md#processfeaturesrequire_module
13021302
[`require.main`]: #requiremain
13031303
[exports shortcut]: #exports-shortcut
1304+
[module namespace object]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import#module_namespace_object
13041305
[module resolution]: #all-together
13051306
[native addons]: addons.md
13061307
[subpath exports]: packages.md#subpath-exports

0 commit comments

Comments
 (0)