-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathnext.config.ts
More file actions
31 lines (25 loc) · 785 Bytes
/
Copy pathnext.config.ts
File metadata and controls
31 lines (25 loc) · 785 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
import type { NextConfig } from "next";
function normalizeBasePath(value: string | undefined): string {
const trimmed = value?.trim() ?? "";
if (!trimmed || trimmed === "/") {
return "";
}
return `/${trimmed.replace(/^\/+|\/+$/g, "")}`;
}
const isGithubPages = process.env.GITHUB_ACTIONS === "true";
const repoName = process.env.GITHUB_REPOSITORY?.split("/")[1] ?? "open-thymos";
const inferredBasePath = isGithubPages ? `/${repoName}` : "";
const basePath = normalizeBasePath(process.env.NEXT_PUBLIC_BASE_PATH || inferredBasePath);
const nextConfig: NextConfig = {
reactStrictMode: true,
output: "export",
trailingSlash: true,
basePath,
images: {
unoptimized: true,
},
env: {
NEXT_PUBLIC_BASE_PATH: basePath,
},
};
export default nextConfig;