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

Support import astro components with vite queries #11478

Merged
merged 1 commit into from
Jul 17, 2024
Merged

Conversation

bluwy
Copy link
Member

@bluwy bluwy commented Jul 17, 2024

Changes

fix #11410

In the transform hook, if the id has Vite special queries, we skip transforming it, because the code will already be in JS when Vite handles the load().

Testing

Added test

Docs

n/a. bug fix.

Copy link

changeset-bot bot commented Jul 17, 2024

🦋 Changeset detected

Latest commit: 98922d2

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

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Jul 17, 2024
@@ -50,3 +50,12 @@ const postfixRE = /[?#].*$/s;
export function cleanUrl(url: string): string {
return url.replace(postfixRE, '');
}

const specialQueriesRE = /(?:\?|&)(?:url|raw|direct)(?:&|$)/;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be great if Vite exposed a blessed way to do this, I've had this usecase before

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah perhaps it could. It already exposes APIs like isCSSRequest

@bluwy bluwy merged commit 3161b67 into main Jul 17, 2024
13 checks passed
@bluwy bluwy deleted the handle-vite-queries branch July 17, 2024 14:57
@astrobot-houston astrobot-houston mentioned this pull request Jul 17, 2024
@astrobot-houston astrobot-houston mentioned this pull request Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Astro somponent with ?raw suffix no longer a string, previously was
2 participants