Docs
Deployment of this Nextjs Template

Deployment of this Nextjs Template

Deploying your Next.js app to multiple platforms with SSG support.

deploy to multi platforms with SSG

To make same code deployed in these three platforms below, I have done some compat logic in next.config.js with environment variable.

See detail

cloudflare pages

Build command

pnpm dlx tsx --tsconfig ./tsconfig.scripts.json ./src/scripts/build-registry.mts && npx next build

Environment Variable

  • NODE_VERSION=20.18.0
  • PLATFORM=cloudflare pages

github pages

rename src/components/icons.tsx to another name, e.g. src/components/my-icons.tsx

Environment Variable

PLATFORM=github pages has been written in yml file of github workflow, there is nothing has to be done.

vercel

Build command

tsx --tsconfig ./tsconfig.scripts.json ./src/scripts/build-registry.mts && next build

Environment Variable

PLATFORM=vercel