-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.mjs
More file actions
30 lines (26 loc) · 843 Bytes
/
next.config.mjs
File metadata and controls
30 lines (26 loc) · 843 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 === 'true'
// When building on GitHub Actions for Pages, use the repo name as basePath
let basePath = ''
let assetPrefix = ''
const repo = process.env.GITHUB_REPOSITORY?.split('/')[1] || ''
if (isGithubActions && repo) {
basePath = `/${repo}`
assetPrefix = `/${repo}/`
} else if (process.env.NODE_ENV === 'production') {
// For GitHub Pages deployment
basePath = '/my-portfolio'
assetPrefix = '/my-portfolio/'
}
const nextConfig = {
eslint: { ignoreDuringBuilds: true },
typescript: { ignoreBuildErrors: true },
images: { unoptimized: true },
// Static export for GitHub Pages
output: 'export',
trailingSlash: true,
// Apply basePath/assetPrefix for production builds
basePath,
assetPrefix,
}
export default nextConfig