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(importMetaGlob): handle alias that starts with hash #17743

Merged
merged 2 commits into from
Jul 23, 2024

Conversation

bluwy
Copy link
Member

@bluwy bluwy commented Jul 23, 2024

Description

fix #17614
ref #12467

The importMetaGlob logic always assumed globs that starts with # are subpath imports, and so the resolved path is relative and should join to the root. However, aliases that starts with # could resolve too, which returns an absolute path.

Due to the previous assumption, the root and absolute path was joined, causing an invalid path for globbing.

This PR fixes it by returning the subpath imports resolved path as absolute instead, preventing the need for any special handling. This means the pre + globSafeResolvedPath(resolved, glob) part also gets executed for subpath imports, which I think it's more correct and handles the edge cases there.

@bluwy bluwy added the p3-minor-bug An edge case that only affects very specific usage (priority) label Jul 23, 2024
Copy link

stackblitz bot commented Jul 23, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@patak-dev
Copy link
Member

/ecosystem-ci run

@vite-ecosystem-ci
Copy link

📝 Ran ecosystem CI on 052a18c: Open

suite result latest scheduled
astro failure failure
nuxt failure failure
sveltekit success failure
vike failure failure
vite-plugin-react-pages failure failure
vitest failure failure

analogjs, histoire, ladle, laravel, marko, previewjs, quasar, qwik, rakkas, remix, unocss, vite-plugin-pwa, vite-plugin-react, vite-plugin-react-swc, vite-plugin-svelte, vite-plugin-vue, vite-setup-catalogue, vitepress

@patak-dev patak-dev merged commit b58b423 into main Jul 23, 2024
12 checks passed
@patak-dev patak-dev deleted the fix-alias-with-hash branch July 23, 2024 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Alias prefixed with # doesn't work with import.meta.glob
2 participants