Hey, I have a question regards require() and resolving symlinks.

Consider this structure:
a/main.js
a/node_modules/b/index.js --> /b/index.js
b/index.js
b/node_modules/c/index.js --> /c/index.js

$ cat /a/main.js
require('b');

$ cat /b/index.js
require('c');

$ node a/main.js will fail to load 'c', because (as described in
http://nodejs.org/api/modules.html) it resolves symlinks and then does look
up relatively to the file content - symlink destination (not the symlink
path).

What are the reasons for this behavior ? I would expect otherwise.

Then, if you wanted to resolve deps relatively to the symlink destination,
you would create symlinks to directories, rather then individual files.

I'm asking, because the current behavior makes it very difficult to enable
local modules with our build tools + scm.

Thanks a lot for help,

V.

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to