Webpack "there are multiple modules with names that only differ in casing"
- Posted in
So you go into Visual Studio Code, fire up the terminal, run npm start and suddenly you see these ugly warning all over the place, when no code was changed and it had worked before. WTH?!
And of course, the first thing you do is google the error "there are multiple modules with names that only differ in casing" and click on the first StackOverflow link found and you find the exact problem that you have. But the leading answer was completely misleading for me.
Here is my scenario: I have a folder that is a clone of a Git repo. I had added another folder with a completely new React application to the same repo, meaning I have to open Visual Studio Code in the main folder, but then change directory in the terminal before I can run commands like npm start. And what I did was do a simple cd myappfolder, like I would normally do and noticed in passing and immediately dismissed that the path in the terminal is now shown as MainFolder/myappfolder and not MainFolder/MyAppFolder as it is on the disk. And that was the exact issue! All I had to do was cd ../MyAppFolder and the annoying warning disappeared.
To be fair, that's actually the second answer for the SO question, but it did make me waste a few minutes looking at import statements. Lesson learned: when you change directory from the Code terminal, use the Tab autocomplete feature to get disk paths with their actual capitalization!
And it's clear that this ridiculous issue has caused others a lot of grief, too, as the same answer was rewarded with +50 SO points by someone. Me, being a cheap bastard, I am not doing that.