-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
import.meta.url URLs incorrectly require ./
#19827
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
Comments
this isn't as simple as i thought, it seems. nuxt currently aliases without nuxt, things work, so this change would actually just be an optimisation (avoiding visiting the resolver by directly loading relative files). however, this points out that relative URLs are currently eaten up by the resolve plugin. if we load so you could argue that the alias plugin should ignore but then what is the expected behaviour in other directories? if i load i feel like someone in the wild must be relying on being able to use these aliases in edit: nuxt/ui depends on the nuxt aliases existing, and of course lives in |
Real-world reproduction (sort of minimal): WORKING: Vite with FAILING: Nuxt (+vite) with Log
|
Describe the bug
When using
URL
to resolve assets for things like workers, a relative path doesn't actually need to begin with./
For example:
Inside vite, we currently assume all relative URLs begin with
./
here:vite/packages/vite/src/node/plugins/assetImportMetaUrl.ts
Lines 118 to 133 in e2e11b1
this results in
foo/bar
warning us (via this warning), but./foo/bar
working correctly.we should probably be treating all
URL
urls which are not absolute as relative (since that is whatURL
itself is doing).though i see you have a bunch of astro-specific logic in there currently and im not sure how such a change would affect that.
Reproduction
https://github.com/vueuse/playground.vueuse.org/
Steps to reproduce
Build the vueuse playground without this patch.
You'll see a warning without the patch, and no warning with it.
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: