| import { fileURLToPath } from "node:url"; |
| import { dirname, join } from "node:path"; |
|
|
| const projectRoot = dirname(fileURLToPath(import.meta.url)); |
| |
| |
| const tracingRoot = process.env.NEXT_TRACING_ROOT_MODE === "workspace" |
| ? join(projectRoot, "..") |
| : projectRoot; |
| const proxyClientMaxBodySize = process.env.NINEROUTER_PROXY_CLIENT_MAX_BODY_SIZE || "128mb"; |
|
|
| |
| const nextConfig = { |
| distDir: process.env.NEXT_DIST_DIR || ".next", |
| output: "standalone", |
| serverExternalPackages: ["better-sqlite3", "sql.js", "node:sqlite", "bun:sqlite"], |
| turbopack: { |
| root: tracingRoot |
| }, |
| outputFileTracingRoot: tracingRoot, |
| outputFileTracingExcludes: { |
| "*": ["./gitbook/**/*"] |
| }, |
| images: { |
| unoptimized: true |
| }, |
| env: {}, |
| experimental: { |
| |
| proxyClientMaxBodySize, |
| |
| serverComponentsHmrCache: true, |
| }, |
| webpack: (config, { isServer }) => { |
| |
| if (!isServer) { |
| config.resolve.fallback = { |
| ...config.resolve.fallback, |
| fs: false, |
| path: false, |
| }; |
| } |
| |
| config.watchOptions = { ...config.watchOptions, ignored: /[\\/](logs|\.next|gitbook|cli)[\\/]/ }; |
| return config; |
| }, |
| async rewrites() { |
| return [ |
| { |
| source: "/v1/v1/:path*", |
| destination: "/api/v1/:path*" |
| }, |
| { |
| source: "/v1/v1", |
| destination: "/api/v1" |
| }, |
| { |
| source: "/codex/:path*", |
| destination: "/api/v1/responses" |
| }, |
| { |
| source: "/v1/:path*", |
| destination: "/api/v1/:path*" |
| }, |
| { |
| source: "/v1", |
| destination: "/api/v1" |
| } |
| ]; |
| } |
| }; |
|
|
| export default nextConfig; |
|
|