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/
This commit is contained in:
NIJAT
2025-12-29 18:34:48 +04:00
parent 40c93ee13e
commit 9930abd991
2 changed files with 3 additions and 1 deletions

View File

@@ -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,
},

View File

@@ -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",