-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.ts
More file actions
41 lines (32 loc) · 1.16 KB
/
next.config.ts
File metadata and controls
41 lines (32 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import type { NextConfig } from "next";
// Determine if we're building for static GitHub Pages (only when explicitly set)
const isGitHubPages = process.env.DEPLOY_TARGET === 'github-pages';
// Base path for GitHub Pages deployment
const basePath = isGitHubPages ? '/Sharothee-Wedding-arvinwedsincia' : '';
const nextConfig: NextConfig = {
// Only enable static export for GitHub Pages deployment
// For VPS/production deployment, we need server-side features (API routes, NextAuth)
...(isGitHubPages ? { output: 'export' as const } : {}),
// Configure for GitHub Pages subdirectory deployment (only when needed)
...(isGitHubPages ? {
basePath: basePath,
assetPrefix: basePath,
trailingSlash: true,
} : {}),
// Output directory
distDir: '.next',
// Optimize images - unoptimized only for static export
images: {
unoptimized: isGitHubPages,
},
// Experimental features
experimental: {
// Remove esmExternals to avoid warnings
},
// Environment variables available to the browser
env: {
NEXT_PUBLIC_BASE_PATH: basePath,
NEXT_PUBLIC_API_AVAILABLE: isGitHubPages ? 'false' : 'true',
},
};
export default nextConfig;