Remix Utils - v9.0.0
    Preparing search index...
    • Preload the assets linked in the routes matching the current request. This function will preload any <link rel="preload" /> tag added with LinksFunction and any CSS files linked with <link rel="stylesheet" />.

      Parameters

      • context: EntryContext

        Remix's EntryContext

      • headers: Headers

        The headers object to append the preload links to

      Returns void

      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,
      });
      }