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
resolve currentPath #4591
resolve currentPath #4591
Conversation
Can you add a test that is fixed by this change? |
Codecov Report
@@ Coverage Diff @@
## master #4591 +/- ##
=======================================
Coverage 98.86% 98.86%
=======================================
Files 209 209
Lines 7345 7345
Branches 2098 2098
=======================================
Hits 7262 7262
Misses 27 27
Partials 56 56
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
@lukastaegert ,you mean in test directory add a new test case? i had found a test case “test/chunking-form/samples/preserve-modules-root “, it do pass in windows。 should i need add a new test case? |
Yes. The old test case was green without your change, so it was not good enough. We need a test that does not pass without your change. It would also help me and others understand the issue better, is useful for debugging and of course prevents us from breaking it again if we change the logic later |
I've digged more deeply into this issue that it turns out to be an issue with TL;DR Vite normalize all file ids to use slash
|
Situation | currentPath |
preserveModulesRoot |
Outcome |
---|---|---|---|
pure rollup build | C:\\path/foo.ext |
C:\\path |
true |
vite build | C:/path/foo.ext |
C:\\path |
false |
And the node path.dirname
preserves slashes.
console.log(path.dirname('C:\\foo\\bar.ext')); // -> 'C:\\foo'
console.log(path.dirname('C:\\foo/bar.ext')); // -> 'C:\\foo'
console.log(path.dirname('C:/foo/bar.ext')); // -> 'C:/foo'
So the old test is still valid, as long as ids are not passed from outside.
Conclusion
I'm afraid adding a resolve
to currentPath
is the only fix, since it will take significant time to rewrite vite for slash problems.
Related issues: #4496 vitejs/vite#6509 |
ee5b9e6
to
4ab4a86
Compare
943f278
to
42c3697
Compare
I added the test myself... |
This PR contains:
Are tests included?
Breaking Changes?
List any relevant issue numbers:
Description