fix: recognize win32 relative paths in getType and isRelativeRequest#564
fix: recognize win32 relative paths in getType and isRelativeRequest#564xiaoxiaojx wants to merge 6 commits into
Conversation
On Windows, path.relative() returns backslash-separated paths like "..\src". These were classified as Normal (bare specifier) instead of Relative, causing the resolver to look in node_modules instead of resolving relative to the context directory. - getType: treat .\ and ..\ the same as ./ and ../ - normalize: convert backslashes to forward slashes for Relative paths - isRelativeRequest: recognize .\ and ..\ as relative Fixes #401
🦋 Changeset detectedLatest commit: 1c72b66 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #564 +/- ##
=======================================
Coverage 96.51% 96.52%
=======================================
Files 50 50
Lines 2896 2903 +7
Branches 911 915 +4
=======================================
+ Hits 2795 2802 +7
Misses 85 85
Partials 16 16
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Merging this PR will degrade performance by 51.42%
Performance Changes
Comparing |
Also fix join() to convert backslashes in request when rootPath is non-AbsoluteWin, so posixNormalize can correctly resolve ".." segments.
This reverts commit b8f1b83.
alexander-akait
left a comment
There was a problem hiding this comment.
To be honestly I am not sure we really need to allow this, we should check is require.resolve and import.meta.resolve supports win32 paths, if yes, we will ship it, if no, it is limitation, like globs, they are support only /
Summary
fixes #401
fixes #436
What kind of change does this PR introduce?
fix
Did you add tests for your changes?
Yes
Does this PR introduce a breaking change?
No
If relevant, what needs to be documented once your changes are merged or what have you already documented?
Nothing