-
Notifications
You must be signed in to change notification settings - Fork 29.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
require does not work as described in the documentation #18695
Comments
I guess this how to interpret the module loading logic - my annotations in grey: Input:
LOAD_AS_FILE(X)
LOAD_AS_DIRECTORY(X)
It is working as per the documentation. Closing as answered, let me know if you think otherwise. |
I think this is addressed by #15015? |
@richardlau racy :D It is handled as semver-major because it was wrong for a very long time and there is a chance that code relies on the faulty behavior. So it will only be released in v.10.0.0. |
@BridgeAR / @richardlau - can you please clarify for my understanding? - I don't see any deviation from the doc, nor I see a doc update as part of #15015! |
@gireeshpunathil the issue is this part of your annotations:
This describes the incorrect behaviour, it should not fail here and X should be tried as a file. #15015 fixes the behaviour so that it matches the doc. |
ah! ok, thanks @richardlau for the clarification. |
I have this file structure:
app.js
console.log( require.resolve('./hello') );
package.json
{ "main": "test" }
other files are empty.
run:
node app.js
if rely on the documentation require should find file underlined in the picture below:
hello.js
but it finds this:
test.js
It should find file in step 3.a but it finds in step 3.b
The text was updated successfully, but these errors were encountered: