summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoine du Hamel <duhamelantoine1995@gmail.com>2022-04-20 01:34:02 +0200
committerGitHub <noreply@github.com>2022-04-20 00:34:02 +0100
commit1fe5d56403a3725eac5e67c7a08830ce5ee0e2f5 (patch)
tree0adc8fdd0fda40c5d69702970be06e91cc6aec59
parent1b8d1794cfd764a233d060f1df96ed9fb10a0106 (diff)
downloadnode-new-1fe5d56403a3725eac5e67c7a08830ce5ee0e2f5.tar.gz
doc: clarify core modules that can be loaded without a prefix
Refs: https://github.com/nodejs/node/pull/42325 PR-URL: https://github.com/nodejs/node/pull/42753 Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: Mestery <mestery@protonmail.com>
-rw-r--r--doc/api/modules.md13
1 files changed, 8 insertions, 5 deletions
diff --git a/doc/api/modules.md b/doc/api/modules.md
index 0264c4ff55..66764d5905 100644
--- a/doc/api/modules.md
+++ b/doc/api/modules.md
@@ -333,15 +333,17 @@ described in greater detail elsewhere in this documentation.
The core modules are defined within the Node.js source and are located in the
`lib/` folder.
-Core modules are always preferentially loaded if their identifier is
-passed to `require()`. For instance, `require('http')` will always
-return the built in HTTP module, even if there is a file by that name.
-
-Core modules can also be identified using the `node:` prefix, in which case
+Core modules can be identified using the `node:` prefix, in which case
it bypasses the `require` cache. For instance, `require('node:http')` will
always return the built in HTTP module, even if there is `require.cache` entry
by that name.
+Some core modules are always preferentially loaded if their identifier is
+passed to `require()`. For instance, `require('http')` will always
+return the built-in HTTP module, even if there is a file by that name. The list
+of core modules that can be loaded without using the `node:` prefix is exposed
+as [`module.builtinModules`][].
+
## Cycles
<!--type=misc-->
@@ -1092,6 +1094,7 @@ This section was moved to
[`__dirname`]: #__dirname
[`__filename`]: #__filename
[`import()`]: https://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#Dynamic_Imports
+[`module.builtinModules`]: module.md#modulebuiltinmodules
[`module.children`]: #modulechildren
[`module.id`]: #moduleid
[`module` core module]: module.md