@@ -312,7 +312,7 @@ them as different modules and will reload the file multiple times. For example,
312
312
` require('./foo') ` and ` require('./FOO') ` return two different objects,
313
313
irrespective of whether or not ` ./foo ` and ` ./FOO ` are the same file.
314
314
315
- ## Core modules
315
+ ## Built-in modules
316
316
317
317
<!-- type=misc-->
318
318
@@ -328,20 +328,31 @@ changes:
328
328
Node.js has several modules compiled into the binary. These modules are
329
329
described in greater detail elsewhere in this documentation.
330
330
331
- The core modules are defined within the Node.js source and are located in the
331
+ The built-in modules are defined within the Node.js source and are located in the
332
332
` lib/ ` folder.
333
333
334
- Core modules can be identified using the ` node: ` prefix, in which case
334
+ built-in modules can be identified using the ` node: ` prefix, in which case
335
335
it bypasses the ` require ` cache. For instance, ` require('node:http') ` will
336
336
always return the built in HTTP module, even if there is ` require.cache ` entry
337
337
by that name.
338
338
339
- Some core modules are always preferentially loaded if their identifier is
339
+ Some built-in modules are always preferentially loaded if their identifier is
340
340
passed to ` require() ` . For instance, ` require('http') ` will always
341
341
return the built-in HTTP module, even if there is a file by that name. The list
342
- of core modules that can be loaded without using the ` node: ` prefix is exposed
342
+ of built-in modules that can be loaded without using the ` node: ` prefix is exposed
343
343
as [ ` module.builtinModules ` ] [ ] .
344
344
345
+ ### Built-in modules with mandatory ` node: ` prefix
346
+
347
+ When being loaded by ` require() ` , some built-in modules must be requested with the
348
+ ` node: ` prefix. This requirement exists to prevent newly introduced built-in
349
+ modules from having a conflict with user land packages that already have
350
+ taken the name. Currently the built-in modules that requires the ` node: ` prefix are:
351
+
352
+ * [ ` node:sea ` ] [ ]
353
+ * [ ` node:test ` ] [ ]
354
+ * [ ` node:test/reporters ` ] [ ]
355
+
345
356
## Cycles
346
357
347
358
<!-- type=misc-->
@@ -484,7 +495,7 @@ folders as modules, and work for both `require` and `import`.
484
495
<!-- type=misc-->
485
496
486
497
If the module identifier passed to ` require() ` is not a
487
- [ core ] ( #core -modules ) module, and does not begin with ` '/' ` , ` '../' ` , or
498
+ [ built-in ] ( #built-in -modules ) module, and does not begin with ` '/' ` , ` '../' ` , or
488
499
` './' ` , then Node.js starts at the directory of the current module, and
489
500
adds ` /node_modules ` , and attempts to load the module from that location.
490
501
Node.js will not append ` node_modules ` to a path already ending in
@@ -1097,6 +1108,9 @@ This section was moved to
1097
1108
[ `module.id` ] : #moduleid
1098
1109
[ `module` core module ] : module.md
1099
1110
[ `module` object ] : #the-module-object
1111
+ [ `node:sea` ] : single-executable-applications.md#single-executable-application-api
1112
+ [ `node:test/reporters` ] : test.md#test-reporters
1113
+ [ `node:test` ] : test.md
1100
1114
[ `package.json` ] : packages.md#nodejs-packagejson-field-definitions
1101
1115
[ `path.dirname()` ] : path.md#pathdirnamepath
1102
1116
[ `require.main` ] : #requiremain
0 commit comments