Remix's EntryContext
The headers object to append the preload links to
export default function handleRequest(
request: Request,
statusCode: number,
headers: Headers,
context: EntryContext
) {
let markup = renderToString(
<RemixServer context={context} url={request.url} />
);
headers.set("Content-Type", "text/html");
preloadLinkedAssets(context, headers); // add this line
return new Response("<!DOCTYPE html>" + markup, {
status: statusCode,
headers: headers,
});
}
Preload the assets linked in the routes matching the current request. This function will preload any
<link rel="preload" />
tag added withLinksFunction
and any CSS files linked with<link rel="stylesheet" />
.