module.builtinModules


Node.js 提供的所有模块名称列表。

🌐 A list of the names of all modules provided by Node.js.

import { builtinModules } from 'node:module';
console.log(builtinModules.filter((name) => name.startsWith('path')));
// Prints: [ 'path', 'path/posix', 'path/win32' ] 

要测试一个模块名是否对应内置模块,可以使用 module.isBuiltin()。

🌐 To test whether a module name corresponds to a builtin module, use module.isBuiltin().