-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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 on Windows
#6049
Comments
@wmcmurray Are you saying using cc @nodejs/platform-windows |
@Fishrock123 Both |
Line 229 in a20c700
I'm not sure it's a bug though. |
Yeah, this is not a bug. Require doesn't take file paths; it takes module paths, which are |
@domenic Ok, that make sense. Then my second test (containing a |
Yeah, probably not worth it, so likely it's just going to stay inconsistent forever since we can't change it either way. But the intent is to only use |
Agreed. Closing. |
There's an interesting addendum here and that is that the URL specification permits |
@guybedford If that the case, shouldn't both |
@trusktr in ES modules in browsers, |
Hey, was just wondering if it's not worth making the error message explicit in case |
@wmcmurray Requiring using |
Windows uses backslashes inside paths and it seems to be supported by the
require
function. BUT ! When you use a backslash inside the "current path syntax" (usually./
) it does not work. I found this using therequire.resolve
method directly.Test case :
file /test/index.js :
file /test/stuff/please-require-me.js :
My test output :
As you can see in the second test, the backslash works, but in the third test it fails because it is in the "current path syntax".
Additional notes
I also made a quick check to see if the
.\
is supposed to work, and it does :Specs
The text was updated successfully, but these errors were encountered: