Skip to content

Conversation

Pistonight
Copy link
Contributor

Fixes #178

The root cause is vite always passes in a path with upper case drive letter for importer, but vite.normalizePath does not change the drive letter casing, so when invoked from working directory with lower case drive letter, the config dir is lower case and the importer is upper case, and it will fail to compute a relative path from config dir to importer

In the previous fix, the paths are normalized to lower case, but vite still passes in upper case drive letter for importer and the previous fix didn't call fixFilePathCasing on the importer. So no paths could ever get resolved on Windows (since importer is always upper and configDir always lower case)

I'm fixing this using a simpler approach by only changing path.normalize to capitalize the drive letter. This way, the change is a no-op for non-Windows and for people always using upper case drive letters, which should be much lower risk.

I looked at the is-fs-case-sensitive package and it uses a really dirty hack IMO, which doesn't even cover all the cases since Windows can have per-directory filesystem case sensitivity. So IMO it's better to only change the drive letter part, which should be always case insensitive

Testing
Tested on a minimal project on my Windows environment and the environment I initially discovered this in (which uses lower case drive letter by default)
Verified running build succeeds with both upper and lower case drive letter as working directory

@Pistonight
Copy link
Contributor Author

Hi @aleclarson, will you be able to review this ?

@aleclarson aleclarson merged commit 80b4c63 into aleclarson:master Jul 30, 2025
@aleclarson
Copy link
Owner

@Pistonight Thank you for the fix! I like your solution a lot better :)

@aleclarson
Copy link
Owner

Released in v6.0.0-beta.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Resolve fails on Windows with lowercase drive letters
2 participants