You write a post-build script that wraps _fresh/server.js in each host's entry shape. This comes from the port: an edge function for Netlify, and a Node handler plus Build Output API config for Vercel.
// scripts/netlify-edge.mjs
import server from "../_fresh/server.js";
export default (request) => server.fetch(request);
// scripts/adapt.mjs (runs after `vite build`; host picked by NETLIFY=1 | VERCEL=1)
if (host === "vercel") {
await build({ ...common, entryPoints: ["scripts/vercel-handler.mjs"],
outfile: `${out}/functions/index.func/index.mjs`, platform: "node", target: "node24" });
await Deno.writeTextFile(`${out}/functions/index.func/.vc-config.json`, JSON.stringify({
runtime: "nodejs24.x", handler: "index.mjs", launcherType: "Nodejs", supportsResponseStreaming: true,
}));
// … copy _fresh/client to static/, write config.json routes
} else if (host === "netlify") {
await build({ ...common, entryPoints: ["scripts/netlify-edge.mjs"],
outfile: "netlify/edge-functions/fresh.js", platform: "neutral", external: ["node:*"] });
}
Source: Fresh deployment