This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
node_modules lookup optimization breaks certain project structures #1177
Comments
So then, you're proposing that this bit be removed? Second, if the file calling `require()` is already inside a `node_modules`
hierarchy, then the top-most `node_modules` folder is treated as the
root of the search tree. I have no problem with that. Wanna try a patch? It should be a pretty simple change to the Module._nodeModulePaths method in lib/module.js. (And the doc change, of course.) |
Yes - that's exactly what I mean. I'll try to do the patch. |
I've created a patch that fixes the issue. https://gist.github.com/1023916 |
Awesome. Sorry, I forgot to mention, can you also sign the node CLA? http://nodejs.org/cla.html Patch looks fine, otherwise :) |
Great :) I signed the CLA. |
Landed on 39246f6. Thanks! |
lo1tuma
added a commit
to lo1tuma/node
that referenced
this issue
Sep 3, 2014
The behavior of the `node_modules` lookup algorithm was changed in nodejs#1177, but the documentation was not updated completely to describe the new behavior. The pseudocode of the lookup algorithm also did not metion that `index.json` is tried to be loaded, if you require a folder.
lo1tuma
added a commit
to lo1tuma/node
that referenced
this issue
Sep 3, 2014
The behavior of the `node_modules` lookup algorithm was changed in nodejs#1177, but the documentation was not updated completely to describe the new behavior. The pseudocode of the lookup algorithm did not metion that `index.json` is tried to be loaded if you require a folder.
indutny
pushed a commit
that referenced
this issue
Sep 15, 2014
The behavior of the `node_modules` lookup algorithm was changed in #1177, but the documentation was not updated completely to describe the new behavior. The pseudocode of the lookup algorithm did not metion that `index.json` is tried to be loaded if you require a folder. Reviewed-By: Fedor Indutny <fedor@indutny.com>
mscdex
pushed a commit
to mscdex/node
that referenced
this issue
Dec 25, 2014
The behavior of the `node_modules` lookup algorithm was changed in nodejs#1177, but the documentation was not updated completely to describe the new behavior. The pseudocode of the lookup algorithm did not metion that `index.json` is tried to be loaded if you require a folder. Reviewed-By: Fedor Indutny <fedor@indutny.com>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
There is a problem with the node_modules lookup optimization.
The problem is it breaks the following simple project structure
now
bar.js
cannot dorequire('general');
because of the optimization.Since the
require
is mostly being done a program boot time it seems like a bad trade-off to not allow the above structure because of an optimization.The text was updated successfully, but these errors were encountered: