-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathnext.config.ts
More file actions
64 lines (55 loc) · 1.83 KB
/
Copy pathnext.config.ts
File metadata and controls
64 lines (55 loc) · 1.83 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import type { NextConfig } from "next";
import createNextIntlPlugin from "next-intl/plugin";
import path from "path";
// Mirror the hardcoded-mode toggle from src/lib/config.ts so the dev proxy
// targets match the runtime config without importing browser-only env code.
const HARDCODED_MODE =
typeof process !== "undefined" && process.env.NEXT_PUBLIC_HARDCODED_MODE !== undefined
? process.env.NEXT_PUBLIC_HARDCODED_MODE === "true"
: true;
const DEVPRINT_TARGET = HARDCODED_MODE
? "https://devprint-v2-production.up.railway.app"
: (process.env.DEVPRNT_CORE_URL || "https://devprint-v2-production.up.railway.app").replace(
/\/$/,
""
);
const PONZINOMICS_TARGET = HARDCODED_MODE
? "https://ponzinomics-production.up.railway.app"
: (process.env.PONZINOMICS_API_URL || "https://ponzinomics-production.up.railway.app").replace(
/\/$/,
""
);
const nextConfig: NextConfig = {
// Pin the tracing root to this app's directory. Prevents Next.js from
// inferring the monorepo root (where the parent bun.lock lives) and
// duplicating the path on Vercel builds.
outputFileTracingRoot: path.resolve(__dirname),
// i18n routing is handled by middleware
async rewrites() {
return [
{
source: "/api/devprint/:path*",
destination: `${DEVPRINT_TARGET}/:path*`,
},
{
source: "/api/ponzinomics/:path*",
destination: `${PONZINOMICS_TARGET}/:path*`,
},
];
},
images: {
remotePatterns: [
{ protocol: "https", hostname: "**" },
{ protocol: "http", hostname: "**" },
],
},
typescript: {
ignoreBuildErrors: true,
},
experimental: {
// Required for React 19 + Next.js 16 compatibility
serverActions: {},
},
};
const withNextIntl = createNextIntlPlugin("./src/i18n/request.ts");
export default withNextIntl(nextConfig);