2026-05-08 01:23:27 +05:30
|
|
|
/** @type {import('next').NextConfig} */
|
2026-05-08 14:14:26 +05:30
|
|
|
const isProd = process.env.NODE_ENV === "production";
|
|
|
|
|
|
|
|
|
|
// Where the Go backend is listening during `npm run dev`.
|
2026-05-08 19:19:30 +05:30
|
|
|
const apiTarget = process.env.FLOW_API_URL ?? "http://localhost:8090";
|
2026-05-08 14:14:26 +05:30
|
|
|
|
2026-05-08 01:23:27 +05:30
|
|
|
const nextConfig = {
|
2026-05-08 14:14:26 +05:30
|
|
|
// Static export only at build time — the Go binary embeds ./out.
|
|
|
|
|
// In dev, leave Next as a normal server so we can proxy /api → Go.
|
|
|
|
|
...(isProd ? { output: "export" } : {}),
|
2026-05-08 01:23:27 +05:30
|
|
|
images: { unoptimized: true },
|
|
|
|
|
trailingSlash: true,
|
|
|
|
|
reactStrictMode: true,
|
2026-05-08 14:14:26 +05:30
|
|
|
|
|
|
|
|
// Dev-only: forward API calls to the Go server.
|
|
|
|
|
async rewrites() {
|
|
|
|
|
if (isProd) return [];
|
|
|
|
|
return [{ source: "/api/:path*", destination: `${apiTarget}/api/:path*` }];
|
|
|
|
|
},
|
2026-05-08 01:23:27 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default nextConfig;
|