@@ -380,7 +380,7 @@ them as different modules and will reload the file multiple times. For example,
380
380
` require('./foo') ` and ` require('./FOO') ` return two different objects,
381
381
irrespective of whether or not ` ./foo ` and ` ./FOO ` are the same file.
382
382
383
- ## Core modules
383
+ ## Built-in modules
384
384
385
385
<!-- type=misc-->
386
386
@@ -396,20 +396,31 @@ changes:
396
396
Node.js has several modules compiled into the binary. These modules are
397
397
described in greater detail elsewhere in this documentation.
398
398
399
- The core modules are defined within the Node.js source and are located in the
399
+ The built-in modules are defined within the Node.js source and are located in the
400
400
` lib/ ` folder.
401
401
402
- Core modules can be identified using the ` node: ` prefix, in which case
402
+ built-in modules can be identified using the ` node: ` prefix, in which case
403
403
it bypasses the ` require ` cache. For instance, ` require('node:http') ` will
404
404
always return the built in HTTP module, even if there is ` require.cache ` entry
405
405
by that name.
406
406
407
- Some core modules are always preferentially loaded if their identifier is
407
+ Some built-in modules are always preferentially loaded if their identifier is
408
408
passed to ` require() ` . For instance, ` require('http') ` will always
409
409
return the built-in HTTP module, even if there is a file by that name. The list
410
- of core modules that can be loaded without using the ` node: ` prefix is exposed
410
+ of built-in modules that can be loaded without using the ` node: ` prefix is exposed
411
411
as [ ` module.builtinModules ` ] [ ] .
412
412
413
+ ### Built-in modules with mandatory ` node: ` prefix
414
+
415
+ When being loaded by ` require() ` , some built-in modules must be requested with the
416
+ ` node: ` prefix. This requirement exists to prevent newly introduced built-in
417
+ modules from having a conflict with user land packages that already have
418
+ taken the name. Currently the built-in modules that requires the ` node: ` prefix are:
419
+
420
+ * [ ` node:sea ` ] [ ]
421
+ * [ ` node:test ` ] [ ]
422
+ * [ ` node:test/reporters ` ] [ ]
423
+
413
424
## Cycles
414
425
415
426
<!-- type=misc-->
@@ -552,7 +563,7 @@ folders as modules, and work for both `require` and `import`.
552
563
<!-- type=misc-->
553
564
554
565
If the module identifier passed to ` require() ` is not a
555
- [ core ] ( #core -modules ) module, and does not begin with ` '/' ` , ` '../' ` , or
566
+ [ built-in ] ( #built-in -modules ) module, and does not begin with ` '/' ` , ` '../' ` , or
556
567
` './' ` , then Node.js starts at the directory of the current module, and
557
568
adds ` /node_modules ` , and attempts to load the module from that location.
558
569
Node.js will not append ` node_modules ` to a path already ending in
@@ -1166,6 +1177,9 @@ This section was moved to
1166
1177
[ `module.id` ] : #moduleid
1167
1178
[ `module` core module ] : module.md
1168
1179
[ `module` object ] : #the-module-object
1180
+ [ `node:sea` ] : single-executable-applications.md#single-executable-application-api
1181
+ [ `node:test/reporters` ] : test.md#test-reporters
1182
+ [ `node:test` ] : test.md
1169
1183
[ `package.json` ] : packages.md#nodejs-packagejson-field-definitions
1170
1184
[ `path.dirname()` ] : path.md#pathdirnamepath
1171
1185
[ `require.main` ] : #requiremain
0 commit comments