fix: support forwarded dev server refresh
This commit is contained in:
@@ -69,7 +69,12 @@ const trpcLinkOptions = {
|
||||
const sep = input.includes('?') ? '&' : '?';
|
||||
url = `${input}${sep}_t=${Date.now()}`;
|
||||
} else {
|
||||
url = input as string;
|
||||
const requestUrl = new URL(input.url);
|
||||
requestUrl.searchParams.set('_t', Date.now().toString());
|
||||
return globalThis.fetch(new Request(requestUrl.toString(), input), {
|
||||
...(init ?? {}),
|
||||
credentials: "include",
|
||||
});
|
||||
}
|
||||
return globalThis.fetch(url, {
|
||||
...(init ?? {}),
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user