Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions examples/e2e/app-router/app/api/isr/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,18 @@ export async function GET(request: NextRequest) {
// this fails at build time when next.js tries to evaluate the route
try {
// @ts-expect-error
const prerenderManifest = await import(/* webpackIgnore: true */ "./.next/prerender-manifest.json");
const prerenderManifest = await import(/* webpackIgnore: true */ "../../../../prerender-manifest.json", {
with: { type: "json" },
});
manifest = prerenderManifest.default;
} catch {
} catch (e) {
console.error(e);
return new Response(null, { status: 500 });
}

const previewId = manifest.preview.previewModeId;

const host = request.headers.get("host");
const host = request.headers.get("host") ?? "localhost:3001";
const result = await fetch(`http${host?.includes("localhost") ? "" : "s"}://${host}/isr`, {
headers: { "x-prerender-revalidate": previewId },
method: "HEAD",
Expand Down