Skip to content

doc fix: align code example for module.createRequireFromPath() with actual code behavior.

module.createRequireFromPath() takes a filename as argument. But the accompanying code example in the documentation makes it seem like it can take a directory argument as well. However, if a directory is passed as argument instead of a filename, then the function does not work as expected.

Therefore, the fix is to make explicit in the code example that only filenames could be passed to module.createRequireFromPath() and not directory names.

Fixes: https://github.com/nodejs/node/issues/23710 Refs: https://github.com/nodejs/node/pull/24763#discussion_r238051920

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • documentation is changed or added
  • commit message follows commit guidelines

Merge request reports

Loading