module.builtinModules
- 类型: <string[]>
Node.js 提供的所有模块名称列表。可用于验证某个模块是否由第三方维护。
【A list of the names of all modules provided by Node.js. Can be used to verify if a module is maintained by a third party or not.】
在此上下文中,module 并不是 模块封装 提供的同一个对象。要访问它,需要引入 Module 模块:
// module.mjs
// In an ECMAScript module
import { builtinModules as builtin } from 'node:module';// module.cjs
// In a CommonJS module
const builtin = require('node:module').builtinModules;