-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathnext.config.ts
More file actions
34 lines (29 loc) 路 780 Bytes
/
Copy pathnext.config.ts
File metadata and controls
34 lines (29 loc) 路 780 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import type { NextConfig } from "next";
const BACKEND_URL = (
process.env.NEXT_PUBLIC_API_URL || "http://localhost:5000"
).replace(/\/$/, "");
const nextConfig: NextConfig = {
// 1. Stable Turbopack
turbopack: {},
// 2. Remove logs in production (Keep this, it's good!)
compiler: {
removeConsole: process.env.NODE_ENV === "production"
? { exclude: ["error"] }
: false,
},
// 3. 馃毃 REWRITES: The Magic Bridge 馃毃
// Reads process.env.NEXT_PUBLIC_API_URL dynamically
async rewrites() {
return [
{
source: "/api/:path*",
destination: `${BACKEND_URL}/api/:path*`,
},
{
source: "/auth/:path*",
destination: `${BACKEND_URL}/auth/:path*`,
},
];
},
};
export default nextConfig;