fix: support forwarded dev server refresh
This commit is contained in:
@@ -69,7 +69,12 @@ const trpcLinkOptions = {
|
|||||||
const sep = input.includes('?') ? '&' : '?';
|
const sep = input.includes('?') ? '&' : '?';
|
||||||
url = `${input}${sep}_t=${Date.now()}`;
|
url = `${input}${sep}_t=${Date.now()}`;
|
||||||
} else {
|
} 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, {
|
return globalThis.fetch(url, {
|
||||||
...(init ?? {}),
|
...(init ?? {}),
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ const SERVER_ROOT = path.dirname(fileURLToPath(import.meta.url));
|
|||||||
export async function setupVite(app: Express, server: Server) {
|
export async function setupVite(app: Express, server: Server) {
|
||||||
const serverOptions = {
|
const serverOptions = {
|
||||||
middlewareMode: true,
|
middlewareMode: true,
|
||||||
// Disable Vite client-side auto reload/HMR in dev.
|
// Reuse the app HTTP server for HMR so SSH forwarding only needs the app port.
|
||||||
hmr: false as const,
|
hmr: { server },
|
||||||
allowedHosts: true as const,
|
allowedHosts: true as const,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user