| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent c3922af commit 46c880b
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -333,15 +333,17 @@ described in greater detail elsewhere in this documentation. | |||
| 333 | 333 | The core modules are defined within the Node.js source and are located in the | |
| 334 | 334 | `lib/` folder. | |
| 335 | 335 | ||
| 336 | - Core modules are always preferentially loaded if their identifier is | ||
| 337 | - passed to `require()`. For instance, `require('http')` will always | ||
| 338 | - return the built in HTTP module, even if there is a file by that name. | ||
| 339 | - | ||
| 340 | - Core modules can also be identified using the `node:` prefix, in which case | ||
| 336 | + Core modules can be identified using the `node:` prefix, in which case | ||
| 341 | 337 | it bypasses the `require` cache. For instance, `require('node:http')` will | |
| 342 | 338 | always return the built in HTTP module, even if there is `require.cache` entry | |
| 343 | 339 | by that name. | |
| 344 | 340 | ||
| 341 | + Some core modules are always preferentially loaded if their identifier is | ||
| 342 | + passed to `require()`. For instance, `require('http')` will always | ||
| 343 | + return the built-in HTTP module, even if there is a file by that name. The list | ||
| 344 | + of core modules that can be loaded without using the `node:` prefix is exposed | ||
| 345 | + as [`module.builtinModules`][]. | ||
| 346 | + | ||
| 345 | 347 | ## Cycles | |
| 346 | 348 | ||
| 347 | 349 | <!--type=misc--> | |
@@ -1092,6 +1094,7 @@ This section was moved to | |||
| 1092 | 1094 | [`__dirname`]: #__dirname | |
| 1093 | 1095 | [`__filename`]: #__filename | |
| 1094 | 1096 | [`import()`]: https://wiki.developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#Dynamic_Imports | |
| 1097 | + [`module.builtinModules`]: module.md#modulebuiltinmodules | ||
| 1095 | 1098 | [`module.children`]: #modulechildren | |
| 1096 | 1099 | [`module.id`]: #moduleid | |
| 1097 | 1100 | [`module` core module]: module.md | |
| Back | FazBrowse Home | New Git URL |
0 commit comments