-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.js
More file actions
35 lines (32 loc) · 957 Bytes
/
next.config.js
File metadata and controls
35 lines (32 loc) · 957 Bytes
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
/**
* @type {import('next').NextConfig}
*/
const fs = require('fs');
const path = require('path');
const isGithubActions = process.env.GITHUB_ACTIONS === 'true';
const hasCustomDomain = fs.existsSync(path.join(__dirname, 'public', 'CNAME'));
const repoName = 'next-cv';
// Use basePath only when deploying to GitHub Pages WITHOUT a custom domain
const useBasePath = isGithubActions && !hasCustomDomain;
const nextConfig = {
reactStrictMode: true,
images: {
unoptimized: true,
},
// Static export for GitHub Pages
output: 'export',
distDir: 'dist',
// basePath only when deploying to GitHub Pages without custom domain
...(useBasePath && {
basePath: `/${repoName}`,
assetPrefix: `/${repoName}/`,
}),
// Expose basePath to client-side (used by PDF renderer for asset URLs)
env: {
NEXT_PUBLIC_BASE_PATH: useBasePath ? `/${repoName}` : '',
},
turbopack: {
root: __dirname,
},
};
module.exports = nextConfig;