Modules

module.isBuiltin()

Tests whether a string identifies a built-in module in the running Node release. It does not import the module or establish whether a particular operation is safe.

Formal Syntax & Structure

nodejs syntaxnodejs
isBuiltin(moduleName)

Parameters & Attributes

NameTypeDescription
moduleNamestringModule specifier to check.

Return Value

boolean

True when the name identifies a built-in module.

Working Example

Example Snippetnodejs
import { isBuiltin } from "node:module";console.log(isBuiltin("node:path"));console.log(isBuiltin("fictional-package-abc"));
Node.js Reference