-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnext.config.ts
More file actions
49 lines (46 loc) · 1.85 KB
/
Copy pathnext.config.ts
File metadata and controls
49 lines (46 loc) · 1.85 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
import type { NextConfig } from "next";
// The docs are Markdown-first: every page is also served raw at `/docs/<slug>.md`.
// These rewrites are unconditional — they are part of the site, not the API proxy.
const docsRewrites = [
{ source: "/docs.md", destination: "/api/docs/index" },
{ source: "/docs/:slug.md", destination: "/api/docs/:slug" },
];
const nextConfig: NextConfig = {
output: "standalone",
experimental: { optimizePackageImports: ["lucide-react"] },
async rewrites() {
const origin = process.env.SANDCHEST_API_ORIGIN;
// Website stays on Vercel. Do not bake a proxy into the AWS API image or
// enable forwarding until the new API origin passes its release checks.
const proxyApi = process.env.VERCEL === "1" && Boolean(origin);
// Preserve the legacy sandbox API and its existing clients on api.*.
if (proxyApi && origin !== "https://stt-api.sandchest.com")
throw new Error("SANDCHEST_API_ORIGIN must be the verified Sandchest API origin.");
return {
beforeFiles: [
...docsRewrites,
...(proxyApi
? [
// Auth stays on Vercel so its trusted ingress IP is not turned into
// an unresolvable forwarded chain by the extra ALB proxy hop.
{ source: "/api/:path((?!auth(?:/|$)).*)*", destination: `${origin}/api/:path*` },
{ source: "/v2/:path*", destination: `${origin}/v2/:path*` },
]
: []),
],
afterFiles: [],
fallback: [],
};
},
outputFileTracingExcludes: {
"*": ["./.sandchest/**/*"],
},
outputFileTracingIncludes: {
"/docs/**": ["./content/docs/**/*"],
"/api/docs/**": ["./content/docs/**/*"],
"/llms.txt": ["./content/docs/**/*"],
"/llms-full.txt": ["./content/docs/**/*"],
},
serverExternalPackages: ["@electric-sql/pglite", "postgres"],
};
export default nextConfig;