import { createPagesFunctionHandler } from "@remix-run/cloudflare-pages";
// @ts-expect-error
import * as build from "@remix-run/dev/server-build";

const handleRequest = createPagesFunctionHandler({
  build,
  mode: process.env.NODE_ENV,
  getLoadContext: (context) => context,
});

export function onRequest(context: RequestContext) {
  return handleRequest(context);
}
