From 9930abd99113a824cd2afe3309fd0847c1dd0a4d Mon Sep 17 00:00:00 2001 From: NIJAT Date: Mon, 29 Dec 2025 18:34:48 +0400 Subject: [PATCH] fix: support both static export (CF Pages) and standalone (Docker) builds - next.config.ts now checks STATIC_EXPORT env var to toggle output mode - Added pages:build script for Cloudflare Pages to use - Docker uses default 'npm run build' which creates .next/standalone - CF Pages should use 'npm run pages:build' which creates out/ --- next.config.ts | 3 ++- package.json | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/next.config.ts b/next.config.ts index afcbe7e..611e4c2 100644 --- a/next.config.ts +++ b/next.config.ts @@ -1,7 +1,8 @@ import type { NextConfig } from "next"; const nextConfig: NextConfig = { - output: 'export', + // Use 'export' for static hosting (CF Pages), 'standalone' for Docker/self-hosting + output: process.env.STATIC_EXPORT === 'true' ? 'export' : 'standalone', images: { unoptimized: true, }, diff --git a/package.json b/package.json index 3954cee..4bd1e86 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "dev": "next dev", "build": "next build", "build:static": "STATIC_EXPORT=true next build", + "pages:build": "STATIC_EXPORT=true npm run build", "start": "next start", "lint": "eslint", "test": "vitest run",