-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.mjs
30 lines (25 loc) · 937 Bytes
/
next.config.mjs
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
import { env } from "process";
const isRunningOnGithubActions = env.GITHUB_ACTIONS === "true";
const isForGithubPages = env.GITHUB_PAGES === "true";
const repositoryName = env.GITHUB_REPOSITORY?.split("/")[1];
const shouldDeployToGithubPages = isRunningOnGithubActions && isForGithubPages && repositoryName === "hayao0819.com";
/** @type {import("next").NextConfig} */
const switchNextConfig = {
basePath: isForGithubPages ? "/" + repositoryName : "",
assetPrefix: isForGithubPages ? "/" + repositoryName : "",
};
/** @type {import("next").NextConfig} */
const nextConfig = {
swcMinify: true,
output: "export",
trailingSlash: true,
pageExtensions: ["ts", "tsx", "js", "jsx", "md", "mdx"],
images: {
unoptimized: true,
},
...(shouldDeployToGithubPages ? switchNextConfig : {}),
};
if (shouldDeployToGithubPages) {
console.log("Deploying to Github Pages");
}
export default nextConfig;