Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upSuggestion: case-sensitive imports #21736
Comments
This comment has been minimized.
This comment has been minimized.
|
This comment has been minimized.
This comment has been minimized.
Oh interesting. I misunderstood what that meant. It doesn't stop you from creating a new file and importing it in a single place with the wrong case though. |
This comment has been minimized.
This comment has been minimized.
There actually is an option that can be given to the tsservice API ( |
This comment has been minimized.
This comment has been minimized.
@Kovensky there are two parts involved, the comparisons which is managed by |
mhegazy
added
Suggestion
Awaiting More Feedback
labels
Feb 8, 2018
This comment has been minimized.
This comment has been minimized.
I should add the reason why we did not do that is realPath has negative perf implications. |
This comment has been minimized.
This comment has been minimized.
I see. Well it sounds like you guys know what you're doing It looks like a decent performance hit everywhere I've checked. There's a webpack plugin but it makes several calls to the filesystem: https://github.com/Urthen/case-sensitive-paths-webpack-plugin/blob/master/index.js I'm not sure how the TypeScript internals work, but it seems like the performance hit wouldn't be too bad if it were a compile-time check on the import statements rather than actually forcing an error on importing the file. At the very least, we can document it and improve it over time. |
donaldpipowitch
referenced this issue
Jun 18, 2018
Closed
renameFile command updates imports with case insensitive paths #25036
This comment has been minimized.
This comment has been minimized.
tomgruner
commented
Sep 4, 2018
Can I upvote this issue? I spent hours trying to figure out why my TeamCity build was failing only to realize that the project had some imports that were the wrong case! Quite an unexpected gotcha as I thought OSX would not import the file if it was the wrong case. |
This comment has been minimized.
This comment has been minimized.
brandonaaskov
commented
Nov 8, 2018
Just to echo the others here, we were able to run our codebase locally on our macs but it fell over on Heroku because of the wrong casing for the filename, which wasn't obvious and continues to be something we have to keep a keen eye out for (aka old school linting). |
This comment has been minimized.
This comment has been minimized.
briandesousa
commented
Feb 8, 2019
Similar experience here with a build succeeding on Windows 10 and failing on RHEL 7.6 with a "Cannot find module" error. Took a while to figure out it was a case error on the import. I also tried using the forceConsistentCasingInFileNames setting in my tsconfig.json but it did not catch this. |
ccorcos commentedFeb 7, 2018
TypeScript Version: 2.7.0-dev.201xxxxx
My mac does not have case sensitive imports. That is you can import the file
x.js
as./X.js
and everything will work. However, our servers run on linux (like most) and I got a runtime exception that took down the whole server because linux imports are case sensitive.I think this would be an awesome addition to Typescript to prevent fatal mistakes that are hard to catch like this one.
Related Issues:
#14460