-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.js
More file actions
30 lines (24 loc) · 654 Bytes
/
next.config.js
File metadata and controls
30 lines (24 loc) · 654 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
/** @type {import('next').NextConfig} */
const isGithubActions = process.env.GITHUB_ACTIONS || false;
let assetPrefix = '';
let basePath = '';
if (isGithubActions) {
// trim off `refs/heads` to get the branch name
const branch = process.env.GITHUB_REF
? process.env.GITHUB_REF.split('/').pop()
: '';
// Set for GitHub Pages deployment
assetPrefix = branch === 'main' ? '/' : `/${branch}/`;
basePath = branch === 'main' ? '' : `/${branch}`;
}
const nextConfig = {
reactStrictMode: true,
output: 'export',
images: {
unoptimized: true,
},
assetPrefix,
basePath,
trailingSlash: true,
};
module.exports = nextConfig;