Spaces:
Running

WorkPilot-AI / web /next.config.ts
Aynkhn's picture
Deploy WorkPilot demo (part 2)
b657a97 verified
Raw History Blame Contribute Delete
1.51 kB
import type { NextConfig } from "next";
const nextConfig: NextConfig = {
/* config options here */
// Phase 18: the container image (web/Dockerfile) sets NEXT_OUTPUT=standalone for a minimal
// Node server (`node server.js`). Local `next start` and the Playwright e2e keep the default.
...(process.env.NEXT_OUTPUT === "standalone" ? { output: "standalone" as const } : {}),
// Single-port hosts (deploy/hf: a Hugging Face Space exposes one port): build with
// NEXT_PUBLIC_API_URL=/backend and WP_BACKEND_PROXY=http://127.0.0.1:8000, and the web
// server forwards /backend/* to the API running in the same container.
...(process.env.WP_BACKEND_PROXY
? {
async rewrites() {
const target = String(process.env.WP_BACKEND_PROXY).replace(/\/$/, "");
return [{ source: "/backend/:path*", destination: `${target}/:path*` }];
},
}
: {}),
cacheComponents: true,
// Every page behind sign-in renders inside a client-side session gate (AppGate) and loads
// its data in the browser, so dev-time "instant navigation" validation always reports those
// pages as dropped from rendering. Validate only segments that opt in with `instant`.
experimental: {
instantInsights: { validationLevel: "manual-warning" },
},
partialPrefetching: true,
turbopack: {
rules: {
"*.css": {
loaders: ["@tailwindcss/turbopack"],
as: "*.css",
},
},
},
};
export default nextConfig;