-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.js
More file actions
24 lines (20 loc) · 719 Bytes
/
next.config.js
File metadata and controls
24 lines (20 loc) · 719 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
const fs = require('node:fs');
const isGithubActions = process.env.GITHUB_ACTIONS === 'true';
const repository = process.env.GITHUB_REPOSITORY || '';
const repoName = repository.split('/')[1] || '';
const hasCustomDomain = fs.existsSync('./CNAME');
const repoBasePath = !hasCustomDomain && repoName ? `/${repoName}` : '';
const nextConfig = {
reactStrictMode: true,
output: 'export',
trailingSlash: true,
env: {
NEXT_PUBLIC_BASE_PATH: isGithubActions ? repoBasePath : '',
},
images: {
unoptimized: true,
},
basePath: isGithubActions ? repoBasePath : '',
assetPrefix: isGithubActions && repoBasePath ? `${repoBasePath}/` : undefined,
};
module.exports = nextConfig;