Skip to content

Commit 9fea6f9

Browse files
ShuttleLabclaude
andcommitted
refactor: migrate to static export (CF Pages) + Next 16
- output: export → prerender to ./out, pure static (no SSR, no 1101 CPU errors) - drop @cloudflare/next-on-pages (deprecated); Next 15.5.2 → 16.2.6 - force-static on ImageResponse (icon/og) + metadata (sitemap/robots/manifest) routes - security headers → public/_headers; wrangler.toml pages_build_output_dir=out - remove stopgap .npmrc legacy-peer-deps Verified: npm run build EXIT=0, ./out has 8 HTML pages + icons/og/sitemap/health. NOTE: CF Pages dashboard build command must be changed to `npx next build` (framework preset: Next.js Static HTML Export). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent d2defd2 commit 9fea6f9

14 files changed

Lines changed: 1473 additions & 1594 deletions

File tree

‎.npmrc‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎app/api/health/route.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
export const runtime = "edge";
1+
export const dynamic = "force-static";
22

33
export async function GET() {
4-
return Response.json({ ok: true, runtime: "edge" });
4+
return Response.json({ ok: true });
55
}

‎app/icon-192.png/route.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ImageResponse } from "next/og";
22

3-
export const runtime = "edge";
3+
export const dynamic = "force-static";
44

55
export async function GET() {
66
return new ImageResponse(

‎app/icon-512.png/route.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ImageResponse } from "next/og";
22

3-
export const runtime = "edge";
3+
export const dynamic = "force-static";
44

55
export async function GET() {
66
return new ImageResponse(

‎app/icon.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
export const dynamic = "force-static";
2+
13
import { ImageResponse } from "next/og";
24

35
export const size = { width: 32, height: 32 };

‎app/manifest.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
export const dynamic = "force-static";
2+
13
import type { MetadataRoute } from "next";
24

35
export default function manifest(): MetadataRoute.Manifest {

‎app/opengraph-image.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ImageResponse } from "next/og";
22

3-
export const runtime = "edge";
3+
export const dynamic = "force-static";
44
export const alt = "JSON Shuttle - Format, validate, fix and escape JSON";
55
export const size = { width: 1200, height: 630 };
66
export const contentType = "image/png";

‎app/robots.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
export const dynamic = "force-static";
2+
13
import type { MetadataRoute } from "next";
24

35
export default function robots(): MetadataRoute.Robots {

‎app/sitemap.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
export const dynamic = "force-static";
2+
13
import type { MetadataRoute } from "next";
24

35
export default function sitemap(): MetadataRoute.Sitemap {

‎next.config.ts‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import type { NextConfig } from "next";
2-
import { setupDevPlatform } from "@cloudflare/next-on-pages/next-dev";
32

3+
// Static export → Cloudflare Pages (static output in ./out; matches yaml/pdf/image).
4+
// `next build` prerenders every route to static HTML — no SSR, no CF free-tier
5+
// 1101 CPU errors. Security headers live in public/_headers (next.config
6+
// `headers()` is unsupported under output:export).
47
const nextConfig: NextConfig = {
5-
/* config options here */
8+
output: "export",
9+
trailingSlash: true,
10+
images: { unoptimized: true },
611
};
712

8-
export default async (): Promise<NextConfig> => {
9-
if (process.env.NODE_ENV === "development") {
10-
await setupDevPlatform();
11-
}
12-
return nextConfig;
13-
};
13+
export default nextConfig;

0 commit comments

Comments
 (0)