“All Together...” documentation is misleading w.r.t. Folder Modules #1851

exogen opened this Issue Oct 10, 2011 · 1 comment


None yet
2 participants

exogen commented Oct 10, 2011

The pseudocode in the All Together section lists this as the final step for LOAD_AS_DIRECTORY(X):


LOAD_AS_FILE(X) then has the following steps:

1. If X is a file, load X as JavaScript text.  STOP
2. If X.js is a file, load X.js as JavaScript text.  STOP

However, X/index (without an extension) is never actually attempted – Node skips straight to X/index.js. I found this misleading, as I expected e.g. require('./path/to/dir') to attempt a file named simply index first (./path/to/dir/index).

(The other documentation for Folder Modules is fine and clearly states that index.js and index.node are attempted.)

isaacs commented Oct 10, 2011

Oh, I see. Yeah, it says that there's a LOAD_AS_FILE(X/index) when really it just tries X/index.js and X/index.node.

Doc correction coming.

isaacs closed this in ff942c6 Oct 10, 2011

@kuebk kuebk pushed a commit to kuebk/node that referenced this issue Oct 11, 2011

@isaacs isaacs Fix #1851 Correct X/index doc 4f91b72
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment