30 lines
788 B
TypeScript
30 lines
788 B
TypeScript
import type { NextConfig } from "next";
|
|
import path from "node:path";
|
|
|
|
function normalizeBasePath(value: string | undefined): string | undefined {
|
|
const trimmed = value?.trim();
|
|
if (!trimmed || trimmed === "/") {
|
|
return undefined;
|
|
}
|
|
|
|
const normalized = trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
|
|
return normalized.replace(/\/+$/, "");
|
|
}
|
|
|
|
const basePath = normalizeBasePath(process.env.NEXT_PUBLIC_APP_BASE_PATH);
|
|
|
|
const nextConfig: NextConfig = {
|
|
output: "standalone",
|
|
basePath,
|
|
webpack(config) {
|
|
config.resolve = config.resolve ?? {};
|
|
config.resolve.alias = {
|
|
...(config.resolve.alias ?? {}),
|
|
"@spz-loader/core": path.resolve(process.cwd(), "src/lib/spz-loader-core-shim.ts"),
|
|
};
|
|
return config;
|
|
},
|
|
};
|
|
|
|
export default nextConfig;
|