-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Allow file URLs to be used as import specifiers #9407
Conversation
🦋 Changeset detectedLatest commit: 5fe9955 The changes in this PR will be included in the next version bump. 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how I feel about this... seems like integration hooks should handle conversions from whatever formats we want to support for entrypoints into a valid ID for Vite.
Co-authored-by: Nate Moore <[email protected]>
@natemoo-re I thought about doing it that way, but this is a lower-level solution and enables any vite plugin (in Astro) to use file URLs which is a super convenient way to support this sort of pattern (having some config value that gets piped into a virtual module). So I felt that was better. We already allow full file paths as module specifiers, why not file URLs? It's the same thing, but more universal. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm okay with supporting this! Still think we should fix the inconsistent integration entrypoint support, but that can be a follow-up
@natemoo-re can you explain more? Which integration APIs are inconsistent? I can maybe fix it up here. I just did a quick scan and it looks like all of them save what is passed in directly. Maybe they mutate it further down the stack? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works well, simplifies things. Looks great to me!
IMO that's the inconsistency? Some of them throw helpful errors if they can't resolve the file, some of them don't. Some of them support |
@natemoo-re Do you know which ones behave differently? From looking at the code I don't see a difference. |
Changes
addDevToolbarApp(new URL('./plugin.ts', import.meta.url))
Testing
Docs
N/A, bug fix