-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.ts
More file actions
50 lines (46 loc) · 1.71 KB
/
next.config.ts
File metadata and controls
50 lines (46 loc) · 1.71 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
import type { NextConfig } from "next";
const isDev = process.env.NODE_ENV !== "production";
// Allow tunneled dev (e.g. Cloudflare Tunnel, ngrok) to reach next dev.
// Set TRELLIS_DEV_ORIGIN=your.host.example to whitelist a custom origin.
const devOrigin = process.env.TRELLIS_DEV_ORIGIN;
const nextConfig: NextConfig = {
...(devOrigin ? { allowedDevOrigins: [devOrigin] } : {}),
// Codex SDK uses createRequire(import.meta.url) at runtime to resolve the
// platform-specific CLI binary. Bundling breaks that resolution. Keep it
// external so it runs from real node_modules.
serverExternalPackages: ["@openai/codex-sdk", "@openai/codex"],
// Tunneled dev (Cloudflare CDN, etc.): some CDNs rewrite Next dev's
// `Cache-Control: no-cache` into `max-age=14400`, so edits to globals.css
// don't reach the browser for hours. `no-store` is one of the few
// directives CDNs typically won't override — they treat it as
// bypass-cache. Only apply in dev; production builds use hashed
// filenames so caching is actually useful there.
...(isDev
? {
async headers() {
return [
{
source: "/_next/:path*",
headers: [
{
key: "Cache-Control",
value:
"no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0",
},
],
},
{
source: "/",
headers: [
{
key: "Cache-Control",
value: "no-store, no-cache, must-revalidate, max-age=0",
},
],
},
];
},
}
: {}),
};
export default nextConfig;