From 9f156094ca89d1474fbf1c471354dc94e69398a9 Mon Sep 17 00:00:00 2001 From: "Houston (Bot)" <108291165+astrobot-houston@users.noreply.github.com> Date: Thu, 13 Aug 2026 18:47:28 -0700 Subject: [PATCH] Fix SSR full reload failing to re-import astro:server-app with third-party Vite plugins (#17685) * fix: prefix astro:server-app with virtual: to prevent Vite URL normalization (#17684) Vite's ModuleGraph._resolveUrl() appends the resolved file extension to module URLs that don't start with `virtual:` or contain `\0`. This caused `astro:server-app` to become `astro:server-app.js` in the module graph, which then failed to resolve during SSR full reloads triggered by plugins like @tailwindcss/vite. Rename the virtual module ID from `astro:server-app` to `virtual:astro:server-app` to match the convention already used by `virtual:astro:app`. * Add changeset --------- Co-authored-by: Matthew Phillips --- .changeset/shaky-queens-know.md | 5 +++++ packages/astro/src/vite-plugin-app/index.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/shaky-queens-know.md diff --git a/.changeset/shaky-queens-know.md b/.changeset/shaky-queens-know.md new file mode 100644 index 000000000000..20b4d8221b16 --- /dev/null +++ b/.changeset/shaky-queens-know.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fixes a dev server error where an SSR full reload triggered by a third-party Vite plugin (such as `@tailwindcss/vite`) could fail with `Failed to load url astro:server-app.js` diff --git a/packages/astro/src/vite-plugin-app/index.ts b/packages/astro/src/vite-plugin-app/index.ts index 1989468ee2a2..c5da519168cc 100644 --- a/packages/astro/src/vite-plugin-app/index.ts +++ b/packages/astro/src/vite-plugin-app/index.ts @@ -2,7 +2,7 @@ import type * as vite from 'vite'; const ASTRO_APP_ID = 'virtual:astro:app'; const RESOLVED_ASTRO_APP_ID = '\0' + ASTRO_APP_ID; -export const ASTRO_DEV_SERVER_APP_ID = 'astro:server-app'; +export const ASTRO_DEV_SERVER_APP_ID = 'virtual:astro:server-app'; export function vitePluginApp(): vite.Plugin[] { let command: vite.ResolvedConfig['command'];