fix: support forwarded dev server refresh

This commit is contained in:
2026-07-08 17:45:02 +08:00
parent e4915f327c
commit 6076063be0
2 changed files with 8 additions and 3 deletions

View File

@@ -12,8 +12,8 @@ const SERVER_ROOT = path.dirname(fileURLToPath(import.meta.url));
export async function setupVite(app: Express, server: Server) {
const serverOptions = {
middlewareMode: true,
// Disable Vite client-side auto reload/HMR in dev.
hmr: false as const,
// Reuse the app HTTP server for HMR so SSH forwarding only needs the app port.
hmr: { server },
allowedHosts: true as const,
};