diff --git a/doc/api/modules.md b/doc/api/modules.md index afddbc14c4f387..c6a25df417a1ba 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -598,14 +598,36 @@ filename scales linearly with the number of registered extensions. In other words, adding extensions slows down the module loader and should be discouraged. -#### require.resolve() +#### require.resolve(request[, options]) +* `request` {string} The module path to resolve. +* `options` {Object} + * `paths` {Array} Paths to resolve module location from. If present, these + paths are used instead of the default resolution paths. Note that each of + these paths is used as a starting point for the module resolution algorithm, + meaning that the `node_modules` hierarchy is checked from this location. +* Returns: {string} + Use the internal `require()` machinery to look up the location of a module, but rather than loading the module, just return the resolved filename. +#### require.resolve.paths(request) + + +* `request` {string} The module path whose lookup paths are being retrieved. +* Returns: {Array} + +Returns an array containing the paths searched during resolution of `request`. + ## The `module` Object