aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Florian Lefebvre <contact@florian-lefebvre.dev> 2025-02-14 16:24:52 +0100
committerGravatar GitHub <noreply@github.com> 2025-02-14 16:24:52 +0100
commit3842ce5ec9471d358042b3d9ef697cf06c7a91f6 (patch)
treec3e86855b995a28217ae8c6351d2926b7d7921a2
parent1c941ee2adb02fbb44d9f0a047cf4815030c73af (diff)
downloadastro-3842ce5ec9471d358042b3d9ef697cf06c7a91f6.tar.gz
astro-3842ce5ec9471d358042b3d9ef697cf06c7a91f6.tar.zst
astro-3842ce5ec9471d358042b3d9ef697cf06c7a91f6.zip
fix(vue): compiler fallback (#13251)
* fix(vue): compiler fallback * Update index.ts
-rw-r--r--.changeset/itchy-buckets-dream.md5
-rw-r--r--packages/integrations/vue/src/index.ts5
2 files changed, 9 insertions, 1 deletions
diff --git a/.changeset/itchy-buckets-dream.md b/.changeset/itchy-buckets-dream.md
new file mode 100644
index 000000000..3c26324bf
--- /dev/null
+++ b/.changeset/itchy-buckets-dream.md
@@ -0,0 +1,5 @@
+---
+'@astrojs/vue': patch
+---
+
+Fixes a case where the compiler could not be resolved automatically
diff --git a/packages/integrations/vue/src/index.ts b/packages/integrations/vue/src/index.ts
index f81167323..66e5d269c 100644
--- a/packages/integrations/vue/src/index.ts
+++ b/packages/integrations/vue/src/index.ts
@@ -106,7 +106,7 @@ async function getViteConfiguration(
command: HookParameters<'astro:config:setup'>['command'],
options?: Options,
): Promise<UserConfig> {
- let vueOptions = {
+ const vueOptions = {
...options,
template: {
...options?.template,
@@ -114,6 +114,9 @@ async function getViteConfiguration(
},
} satisfies VueOptions;
+ // The vue vite plugin may not manage to resolve it automatically
+ vueOptions.compiler ??= await import('vue/compiler-sfc');
+
const config: UserConfig = {
optimizeDeps: {
// We add `vue` here as `@vitejs/plugin-vue` doesn't add it and we want to prevent