Skip to content

module: support custom paths to require.resolve()

Rodrigo Muino Tomonari requested to merge github/fork/cjihrig/5963 into master

I originally wrote this for https://github.com/nodejs/node/issues/5963, but didn't open a PR. Today, it was requested again in https://github.com/nodejs/node/issues/16389, so I thought I'd open a PR. I'm not sure how it will be received.

This PR supports passing custom paths to require.resolve(). The custom paths can replace the default paths, be prepended to the default paths, or be appended to the default paths. All of the functionality is isolated to a single if statement, so the impact on code that doesn't use this feature should be extremely minimal.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

module

Merge request reports

Loading