Move the env var read into the rewrites function so `next build` succeeds without MULTICA_API_URL set (it is only needed at runtime). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
32 lines
727 B
TypeScript
32 lines
727 B
TypeScript
import type { NextConfig } from "next";
|
|
|
|
const nextConfig: NextConfig = {
|
|
transpilePackages: ["@multica/ui", "@multica/store", "@multica/hooks", "@multica/sdk"],
|
|
rewrites: async () => {
|
|
const apiUrl = process.env.MULTICA_API_URL;
|
|
if (!apiUrl) return [];
|
|
return [
|
|
{
|
|
source: "/api/:path*",
|
|
destination: `${apiUrl}/api/:path*`,
|
|
},
|
|
];
|
|
},
|
|
headers: async () => [
|
|
{
|
|
source: "/sw.js",
|
|
headers: [
|
|
{
|
|
key: "Cache-Control",
|
|
value: "no-cache, no-store, must-revalidate",
|
|
},
|
|
{
|
|
key: "Content-Type",
|
|
value: "application/javascript; charset=utf-8",
|
|
},
|
|
],
|
|
},
|
|
],
|
|
};
|
|
|
|
export default nextConfig;
|