Skip to content

Module resolution description does not reflect the implementation #7151

Closed
@tai2

Description

  • 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

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to the documentations.moduleIssues and PRs related to the module subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions