Built-in modules
History
node: import support to require(...).Node.js has several modules compiled into the binary. These modules are described in greater detail elsewhere in this documentation.
The built-in modules are defined within the Node.js source and are located in the
lib/ folder.
Built-in 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 built-in 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 all the built-in modules can be retrieved from module.builtinModules.
The modules being all listed without the node: prefix, except those that mandate such
prefix (as explained in the next section).
When being loaded by require(), some built-in modules must be requested with the
node: prefix. This requirement exists to prevent newly introduced built-in
modules from having a conflict with user land packages that already have
taken the name. Currently the built-in modules that requires the node: prefix are:
The list of these modules is exposed in module.builtinModules, including the prefix.