perf upgrade
This commit is contained in:
@@ -343,7 +343,10 @@ async function initializeStaticRoutes(
|
||||
gz,
|
||||
etag,
|
||||
type: metadata.type,
|
||||
immutable: true,
|
||||
// Only Vite's content-hashed output under /assets/ is safe to
|
||||
// cache immutably; unhashed files (favicon, manifest, images)
|
||||
// can change between deploys and must revalidate.
|
||||
immutable: route.startsWith('/assets/'),
|
||||
size: bytes.byteLength,
|
||||
}
|
||||
routes[route] = createResponseHandler(asset)
|
||||
@@ -529,14 +532,9 @@ async function initializeServer() {
|
||||
// Fallback to TanStack Start handler for all other routes
|
||||
'/*': async (req: Request) => {
|
||||
try {
|
||||
const h3Response = await handler.fetch(req)
|
||||
|
||||
const body = await h3Response.arrayBuffer()
|
||||
return new Response(body, {
|
||||
status: h3Response.status,
|
||||
statusText: h3Response.statusText,
|
||||
headers: h3Response.headers,
|
||||
})
|
||||
// Return the handler's Response as-is so streaming bodies
|
||||
// (SSR streaming, SSE event streams) pass through unbuffered.
|
||||
return await handler.fetch(req)
|
||||
} catch (error) {
|
||||
log.error(`Server handler error: ${String(error)}`)
|
||||
return new Response('Internal Server Error', { status: 500 })
|
||||
|
||||
Reference in New Issue
Block a user