fix: normalize resolved result on Windows#322
Closed
sapphi-red wants to merge 2 commits intooxc-project:mainfrom
Closed
fix: normalize resolved result on Windows#322sapphi-red wants to merge 2 commits intooxc-project:mainfrom
sapphi-red wants to merge 2 commits intooxc-project:mainfrom
Conversation
sapphi-red
commented
Nov 25, 2024
| let hash = { | ||
| let mut hasher = FxHasher::default(); | ||
| path.as_os_str().hash(&mut hasher); | ||
| path.hash(&mut hasher); |
Member
Author
There was a problem hiding this comment.
Suggested change
| path.hash(&mut hasher); | |
| #[cfg(windows)] | |
| path.hash(&mut hasher); | |
| #[cfg(not(windows))] | |
| path.as_os_str().hash(&mut hasher); |
It might be possible to do this. But I'm not sure that's safe for all non-Windows OSs.
CodSpeed Performance ReportMerging #322 will degrade performances by 17.72%Comparing Summary
Benchmarks breakdown
|
3 tasks
Member
Author
|
Ah, it seems the test passes with this diff + 08a19d7, but it doesn't with the main branch. |
Member
|
I wonder whether we should force upstream to normalize all paths ... let me think about this. Or, change to a simpler, customized hasher. |
Member
Author
|
I thought it would work with a simple revert, but it turns out it needs a bigger change than that 😅. |
Member
Author
|
I'll leave this one for now. |
Member
No worries, I'll take over. |
Boshen
added a commit
that referenced
this pull request
Dec 5, 2024
Boshen
added a commit
that referenced
this pull request
Dec 5, 2024
Boshen
added a commit
that referenced
this pull request
Dec 5, 2024
Boshen
pushed a commit
that referenced
this pull request
Dec 13, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#316 seems to break Windows.
If the specifier or the base directory contains a forward slash, the resolved result contained a forward slash.
This causes the same module to be resolved differently (e.g.
C:\\foo.jsandC:/foo.js) and ends up bundling the same module twice.For example,
import './foo.js'; import '.\\foo.js'should resolve to the same path.To fix this, without reverting #316, I think it requires thinking about where to normalize the slashes. But it takes some time for me to do that, so in this PR I simply reverted the change.
reverts #316