From 5fe997526f6839826ead2e52e80393573e35279b Mon Sep 17 00:00:00 2001 From: stefan staudenmeyer Date: Sat, 1 Dec 2018 00:25:25 +0100 Subject: [PATCH] module: createRequireFromPath missed docs Fixes: #23710 Adding the missing documentation --- doc/api/modules.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/api/modules.md b/doc/api/modules.md index 28a13fb36dc4b9..3e44610a35fc88 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -914,9 +914,11 @@ added: v10.12.0 function. * Returns: {[`require`][]} Require function +Create a custom require function that will resolve modules relative to the filename path. + ```js const { createRequireFromPath } = require('module'); -const requireUtil = createRequireFromPath('../src/utils'); +const requireUtil = createRequireFromPath('../src/utils'); // can also be a file // require `../src/utils/some-tool` requireUtil('./some-tool');