-
Notifications
You must be signed in to change notification settings - Fork 7.3k
doc: adding note on loading arbitrary paths from node_module #7794
Conversation
Anything I should edit/add/change in this? |
Heya, sorry for missing this. We usually wrap lines at 80 column in all documentation and code. Could you please fix this? Regarding the change itself, I'd rather ask @tjfontaine to take a look at it. |
Sure, will repush this one later today. |
Did update note, honoring the 80 chars limit. |
@tjfontaine ping |
So what you're trying to document is that you can require "into" modules? The phrasing here could be better, we don't really want to say "arbitrary" in quite the same connotation. Does that make sense? |
Should it read like
? |
How about
|
Adding note to api/modules.markdown about ability to load arbitrary path from modules from node_module path by adding reference to path after module name in call to require()
Changed text to what @tjfontaine said. |
There's still a thing that isn't told: if you are missing the file in the original module required it would traverse all the other possible locations and look for while.
And in test-require.js you have
It would still go and get arbitrary.js from test from parent's folder node_modules. |
I ran into this lack of documentation today and found this issue report. I've reviewed the docs and found them to be improvement. Merging is recommended. |
@chrisdickinson LGTM. Feel free to merge. |
Adding note to api/modules.markdown about ability to load arbitrary path from modules from node_module path by adding reference to path after module name in call to require() PR-URL: #7794 Reviewed-by: Trevor Norris <trev.norris@gmail.com> Reviewed-by: Fedor Indutny <fedor@indutny.com> Reviewed-by: Timothy J Fontaine <tjfontaine@gmail.com>
Merged in fd22268. Thanks! |
Adding note to api/modules.markdown about ability to load arbitrary path from modules from node_module path by adding reference to path after module name in call to require(). Possible fix for #7787.