-
Notifications
You must be signed in to change notification settings - Fork 449
Expand file tree
/
Copy pathnext.config.ts
More file actions
55 lines (49 loc) · 1.86 KB
/
Copy pathnext.config.ts
File metadata and controls
55 lines (49 loc) · 1.86 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
import dotenv from "dotenv";
import type { NextConfig } from "next";
import path from "path";
// Load environment variables from the root env file. Honors ENV_FILE (set by
// the Makefile) so per-instance env files like `.env.instance2` are respected;
// defaults to `.env`. Absolute ENV_FILE paths are used as-is.
dotenv.config({
path: path.resolve(process.cwd(), "..", process.env.ENV_FILE || ".env"),
});
function getAllowedDevOrigins(): string[] {
const allowedDevOrigins = process.env.NEXT_ALLOWED_DEV_ORIGINS;
if (!allowedDevOrigins) {
// Only the server's own hostname is allowed.
// No additional origins.
// Explicitly setting an empty array is equivalent to not setting it.
return [];
}
return allowedDevOrigins
.split(",")
.map((origin) => origin.trim())
.filter(Boolean);
}
const nextConfig: NextConfig = {
// Build/dev output directory. Overridable via NEXT_DIST_DIR so multiple
// `next dev` servers can run simultaneously from this same directory: Next.js
// 16 acquires a lock at `<distDir>/lock` keyed on the project dir + distDir
// (not the port), so a second instance must use a distinct distDir.
distDir: process.env.NEXT_DIST_DIR || ".next",
// Increase timeout for API routes
experimental: {
proxyTimeout: 300000, // 5 minutes
},
async rewrites() {
return [{ source: "/mcp/:path*", destination: "/api/mcp/:path*" }];
},
// Disable built-in image optimization so Next does not require the `sharp`
// native dependency (and its LGPL libvips binaries). The only <Image> usage
// is a 32px file-preview thumbnail, which does not benefit from optimization.
images: {
unoptimized: true,
},
// Ignore TypeScript errors during build
typescript: {
ignoreBuildErrors: true,
},
// Allow cross-origin requests in development
allowedDevOrigins: getAllowedDevOrigins(),
};
export default nextConfig;