22
33// @ts -ignore
44import { render } from '../server/entry.server.js' ;
5+ import type { RenderToStringOptions , RenderToStringResult } from '@builder.io/qwik/server' ;
6+
7+ // @ts -ignore
8+ import manifest from '../dist/q-manifest.json' ;
59
610export const onRequestGet : PagesFunction = async ( { request, next, waitUntil } ) => {
711 try {
@@ -11,6 +15,10 @@ export const onRequestGet: PagesFunction = async ({ request, next, waitUntil })
1115 return Response . redirect ( 'https://qwik.builder.io/guide/overview' , 302 ) ;
1216 }
1317
18+ if ( url . pathname === '/chat' ) {
19+ return Response . redirect ( 'https://discord.gg/bNVSQmPzqy' ) ;
20+ }
21+
1422 // Handle static assets
1523 if ( / \. \w + $ / . test ( url . pathname ) || url . pathname === '/repl/' ) {
1624 return next ( request ) ;
@@ -28,13 +36,21 @@ export const onRequestGet: PagesFunction = async ({ request, next, waitUntil })
2836 }
2937 }
3038
31- // Generate Qwik SSR response
32- const ssrResult = await render ( {
39+ // Render To String Options
40+ const opts : RenderToStringOptions = {
3341 url : request . url ,
3442 base : '/build/' ,
35- } ) ;
43+ manifest,
44+ prefetchStrategy : {
45+ symbolsToPrefetch : 'all' ,
46+ implementation : 'worker-fetch' ,
47+ } ,
48+ } ;
49+
50+ // Generate Qwik SSR response
51+ const result : RenderToStringResult = await render ( opts ) ;
3652
37- const response = new Response ( ssrResult . html , {
53+ const response = new Response ( result . html , {
3854 headers : {
3955 'Cross-Origin-Embedder-Policy' : 'credentialless' ,
4056 'Cross-Origin-Opener-Policy' : 'same-origin' ,
0 commit comments