Skip to content
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

fix: correctly resolve types from relative paths on Windows #9446

Merged
merged 3 commits into from
Oct 21, 2023

Conversation

sodatea
Copy link
Member

@sodatea sodatea commented Oct 20, 2023

Closes #8671
Closes vuejs/vue-loader#2048

dirname is the safest way to get a directory name from a path string.

As for this specific bug, it's because
path.posix.join(AnyWindowsPathUsingBackSlashes, '..') returns ..

I'm not sure whether there will be unexpected regression if I modify the joinPaths utility, so I changed the smallest possible bit of code to fix this.

Closes vuejs#8671
Closes vuejs/vue-loader#2048

`dirname` is the safest way to get a directory name from a path string.

As for this specific bug, it's because
`path.posix.join(AnyWindowsPath, '..')` returns `.`.

I'm not sure whether there will be unexpected regression if I modify the
`joinPaths` utility, so I changed the smallest possible bit of code to
fix this.
@github-actions
Copy link

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 85.9 kB 32.7 kB 29.5 kB
vue.global.prod.js 132 kB 49.3 kB 44.3 kB

Usages

Name Size Gzip Brotli
createApp 47.9 kB 18.9 kB 17.2 kB
createSSRApp 50.7 kB 20 kB 18.2 kB
defineCustomElement 50.3 kB 19.6 kB 17.9 kB
overall 61.2 kB 23.7 kB 21.6 kB

@sodatea sodatea marked this pull request as draft October 20, 2023 10:46
Because in the Windows test case, the resolved path isn't normalized
(`C:\\Test/foo`), which, though doesn't affect real-world usage, would
fail in the mock file system.
@sodatea sodatea marked this pull request as ready for review October 20, 2023 11:03
@sodatea sodatea assigned sodatea and unassigned sodatea Oct 20, 2023
@sodatea sodatea added 🐞 bug Something isn't working ❗ p4-important Priority 4: this fixes bugs that violate documented behavior, or significantly improves perf. scope: script-setup labels Oct 20, 2023
@yyx990803 yyx990803 merged commit 089d36d into vuejs:main Oct 21, 2023
11 checks passed
yyx990803 pushed a commit that referenced this pull request Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❗ p4-important Priority 4: this fixes bugs that violate documented behavior, or significantly improves perf. 🐞 bug Something isn't working scope: script-setup
Projects
Development

Successfully merging this pull request may close these issues.

Can't import interface / type and use them with defineProps "failed to resolve import source"
2 participants