Module resolution description does not reflect the implementation

  • Version: v4.4.3
  • Platform: Darwin James.local 15.5.0 Darwin Kernel Version 15.5.0: Tue Apr 19 18:36:36 PDT 2016; root:xnu-3248.50.21~8/RELEASE_X86_64 x86_64
  • Subsystem: Modules

I've just read this:

All Together...
https://nodejs.org/docs/latest/api/modules.html#modules_all_together

From this document, if a script in /Uesrs/foo (Y) does require('/b.js'); (X), it should be resolved to /Users/foo/b.js (Y + X). But as long as I tested, it's resolved to an absolute path (/b.js).

I guess either the document or implementation is wrong.

Here is the code.
https://gist.github.com/tai2/b2121a67cfab8b1945cc4b292fc737dd