import type { NextConfig } from "next"; import path from "path"; /** When `NEXT_STATIC_EXPORT=1`, emit `out/` for embedding behind FastAPI (e.g. Hugging Face Docker Space). */ const staticExport = process.env.NEXT_STATIC_EXPORT === "1"; const basePath = process.env.NEXT_PUBLIC_BASE_PATH?.trim() ?? ""; const nextConfig: NextConfig = { // Keeps output file tracing anchored to this app when multiple lockfiles exist on the machine. outputFileTracingRoot: path.join(process.cwd()), // ESLint 9 + eslint-config-next can throw "Components.detect is not a function" for react plugin; run `npm run lint` locally. eslint: { ignoreDuringBuilds: true, }, ...(staticExport ? { output: "export" as const, images: { unoptimized: true }, } : {}), ...(basePath ? { basePath } : {}), }; export default nextConfig;