2025-12-30 04:02:54 +00:00
|
|
|
import { NextConfig } from "next";
|
|
|
|
|
import { PHASE_DEVELOPMENT_SERVER } from "next/constants";
|
2025-12-12 22:16:21 +00:00
|
|
|
|
2025-12-30 04:02:54 +00:00
|
|
|
const nextConfig = (phase, { defaultConfig }): NextConfig => {
|
2025-12-12 22:16:21 +00:00
|
|
|
return {
|
2025-12-22 14:19:56 +00:00
|
|
|
// Suppress static export config warnings in dev mode as they are not relevant.
|
2025-12-12 22:16:21 +00:00
|
|
|
output: phase === PHASE_DEVELOPMENT_SERVER ? undefined : "export",
|
2025-12-30 04:02:54 +00:00
|
|
|
distDir: "./docs",
|
2025-12-12 22:16:21 +00:00
|
|
|
basePath: "/t2-mapper",
|
|
|
|
|
assetPrefix: "/t2-mapper/",
|
|
|
|
|
trailingSlash: true,
|
2025-12-30 04:02:54 +00:00
|
|
|
reactCompiler: true,
|
2025-12-12 22:16:21 +00:00
|
|
|
headers:
|
2025-12-22 14:19:56 +00:00
|
|
|
// TorqueScript files should be served as text. This won't affect what
|
|
|
|
|
// GitHub Pages does with the static export, but it'll at least improve
|
|
|
|
|
// the dev server. Otherwise, the responses can't be easily inspected in
|
|
|
|
|
// the Network tab.
|
2025-12-12 22:16:21 +00:00
|
|
|
phase === PHASE_DEVELOPMENT_SERVER
|
|
|
|
|
? async () => {
|
|
|
|
|
return [
|
|
|
|
|
{
|
|
|
|
|
source: "/:path*.cs",
|
|
|
|
|
headers: [
|
|
|
|
|
{
|
|
|
|
|
key: "Content-Type",
|
|
|
|
|
value: "text/plain; charset=utf-8",
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
: undefined,
|
2025-12-22 14:19:56 +00:00
|
|
|
// For the dev server, redirect / to the `basePath` for convenience, so you
|
|
|
|
|
// can just open localhost:3000.
|
2025-12-12 22:16:21 +00:00
|
|
|
redirects:
|
|
|
|
|
phase === PHASE_DEVELOPMENT_SERVER
|
|
|
|
|
? async () => {
|
|
|
|
|
return [
|
|
|
|
|
{
|
|
|
|
|
source: "/",
|
|
|
|
|
destination: "/t2-mapper/",
|
|
|
|
|
basePath: false,
|
|
|
|
|
permanent: false,
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
: undefined,
|
|
|
|
|
};
|
2025-09-11 23:48:23 +00:00
|
|
|
};
|
2025-12-30 04:02:54 +00:00
|
|
|
|
|
|
|
|
export default nextConfig;
|