From f4ab20412f459cfbfaacf14bbd5235bca13e4c57 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Sat, 16 Dec 2017 18:36:00 +0100 Subject: [PATCH] doc: improve module.builtinModules documentation PR-URL: https://github.com/nodejs/node/pull/17712 Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: Luigi Pinca Reviewed-By: Jon Moss Reviewed-By: James M Snell --- doc/api/modules.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/api/modules.md b/doc/api/modules.md index 16c01f66fa4..73fd9a28422 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -841,6 +841,13 @@ added: v9.3.0 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 provided +by the [module wrapper][]. To access it, require the `Module` module: + +```js +const builtin = require('module').builtinModules; +``` + [`__dirname`]: #modules_dirname [`__filename`]: #modules_filename [`Error`]: errors.html#errors_class_error @@ -848,4 +855,5 @@ if a module is maintained by a third-party module or not. [`path.dirname()`]: path.html#path_path_dirname_path [exports shortcut]: #modules_exports_shortcut [module resolution]: #modules_all_together +[module wrapper]: #modules_the_module_wrapper [native addons]: addons.html