-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: no asset plugin w/ img is imported with query (#8353)
* fix: no asset plugin w/ img is imported with query * add changeset * add test for the new feature * remove exp * use removeQueryString instead of `includes('?')` it's more explicit --------- Co-authored-by: Erika <[email protected]>
- Loading branch information
1 parent
48ff785
commit 1947ef7
Showing
8 changed files
with
95 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
'astro': patch | ||
--- | ||
|
||
Astro will now skip asset optimization when there is a query in the import. Instead, it will let vite deal with it using plugins. | ||
|
||
```vue | ||
<script> | ||
// This will not return an optimized asset | ||
import Component from './Component.vue?component' | ||
</script> | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 7 additions & 1 deletion
8
packages/integrations/vue/test/fixtures/app-entrypoint/astro.config.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,14 @@ | ||
import { defineConfig } from 'astro/config'; | ||
import vue from '@astrojs/vue'; | ||
import ViteSvgLoader from 'vite-svg-loader' | ||
|
||
export default defineConfig({ | ||
integrations: [vue({ | ||
appEntrypoint: '/src/pages/_app' | ||
})] | ||
})], | ||
vite: { | ||
plugins: [ | ||
ViteSvgLoader(), | ||
], | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
packages/integrations/vue/test/fixtures/app-entrypoint/src/components/Circle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions
5
packages/integrations/vue/test/fixtures/app-entrypoint/src/components/Foo.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
<script setup> | ||
import Circle from './Circle.svg?component' | ||
</script> | ||
|
||
<template> | ||
<div id="foo"> | ||
<Bar /> | ||
<Circle/> | ||
</div> | ||
</template> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.