-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
Importing with different casing breaks instanceof checks #14084
Comments
It seems this may work as intended if I get this right. In case-sensitive OS these would be 2 different modules and Node.js may not distinguish case-sensitiveness of file systems here. See #14019 (comment) But I may be wrong, let's see what others think. |
This is a known problem due to the general case-insensitivity on Windows platforms. From the perspective of our module system, these are different paths, therefore different modules, and we cannot prevent Windows from resolving different paths to the same file. A solution for this particular problem might be to use the lowercase variant of module paths within our cache, making the keys unique again. However, I remember reading something about Windows being able to deal with some case-sensitive filesystems, see e.g. here, so that behavior would eventually break. I don't think there is an efficient solution to this problem and agree with @vsemozhetbyt. You can implement relevant checks in JavaScript by overwriting our module loading implementation with one which checks the capitalization, but this won't be as efficient. |
Thanks for the quick answer. Your explanation sounds reasonable and if there is general consents that there is nothing to fix feel free to close this issue. |
When importing one file with different casing they are both imported correctly without errors, however they are not equal. Because objects instantiated with one import are not
instanceof
the other import.Run following code to see it in action:
or clone and
node index.js
this reproduction repositiory.This is probably related to #7726, #6978 and node-v0.x-archive/pull/6774, however it still exists while the other issues are said to be resolved.
The text was updated successfully, but these errors were encountered: