-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Can't turn off astro:assets for svg #8333
Comments
Seeing the code linked below, I can think of 3 ways I could fix it: astro/packages/astro/src/assets/vite-plugin-assets.ts Lines 123 to 128 in 84427f3
export default defineConfig({
image: {
// I am not proud of the name of this config, we should find a better one.
assetsProcessPredicate(query, importer){
if (importer.endsWith('.vue') && query.endsWith('.svg?component')) {
return false
}
return true
},
},
}) |
This seems valid! Unfortunately the API you suggested isn't really feasible due to design limitations. Maybe we need |
The reason we removed query params is to make sure we don't match API endpoints with query params that ended with file extensions, but I think it would be safe to always skip when there's query params? |
@Princesseuh @natemoo-re I can have a PR skipping every import that has query params ready in a few. What do you think? |
That seems perfectly fine to me! Thinking about it I can't think of an instance where it would break it. We have some tests around this too that should hopefully prove me wrong if needs be |
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
When I use vite-svg-loader to inline svg in my vue components with the following model, I instead get the
astro:assets
optimized object.What's the expected result?
I would expect the
<Chrome/>
and<Firefox/>
to be vue components instead of ImageMetadata.Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-qscvf3?file=src%2Fcomponents%2FTest.vue
Participation
The text was updated successfully, but these errors were encountered: