-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
Closed
Labels
docIssues and PRs related to the documentations.Issues and PRs related to the documentations.moduleIssues and PRs related to the module subsystem.Issues and PRs related to the module subsystem.
Description
The documentation for __dirname
states that it gives "The name of the directory that the currently executing script resides in."
This may be taken to imply that __dirname
always refers to the path of the module that was invoked as a script from the command line. However, it actually always produces the path of the current module, no matter where it was required from.
Just to clarify: assume I have modules
a.js
b/b.js
and a.js
requires b.js
. I run node a.js
, and b.js
uses its __dirname
, which will refer to the b
subdirectory. The current wording implies that it might actually refer to the directory that a.js
is contained in since that is the "script" that I ran from the command line.
Metadata
Metadata
Assignees
Labels
docIssues and PRs related to the documentations.Issues and PRs related to the documentations.moduleIssues and PRs related to the module subsystem.Issues and PRs related to the module subsystem.