Skip to content

doc: improve module.builtinModules documentation

Rodrigo Muino Tomonari requested to merge github/fork/watson/buildins-2 into master

In this PR I've kept the original casing of the object module, but I think it might be easier to understand if we changed the entire section to use the uppercase version: Module. This have two benefits:

  1. It matches what's actually exported when requiring "module"
  2. It's easier to distinguish from the other module object that's available by default to all file modules

That change would instead look like this:

-### module.builtinModules
+### Module.builtinModules
 <!-- YAML
 added: v9.3.0
 -->

 * {string[]}

 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 module or not.

+Note that `Module` in this context isn't the same object that's
+available by default inside file modules. To access it you need to
+require the `Module` module:
+
+```js
+const Module = require('module');
+
+const builtin = Module.builtinModules;
+```
+
Checklist
Affected core subsystem(s)
  • doc

Merge request reports

Loading