mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-01 21:02:12 +03:00
- instrumentation.ts: eval(require) → createRequire (banned in Turbopack edge runtime) - mitm/manager.ts: static imports → lazy require getters to prevent Turbopack trace - mitm/manager.stub.ts: build-time stub for turbopack.resolveAlias - antigravity-mitm/route.ts: dynamic imports + nodejs runtime + remove use server - next.config.mjs: turbopack.resolveAlias for mitm stub + expanded serverExternalPackages - prepublish.mjs: remove --webpack flag (removed in Next.js 15+)
94 lines
2.1 KiB
JavaScript
94 lines
2.1 KiB
JavaScript
import createNextIntlPlugin from "next-intl/plugin";
|
|
|
|
const withNextIntl = createNextIntlPlugin("./src/i18n/request.ts");
|
|
|
|
/** @type {import('next').NextConfig} */
|
|
const nextConfig = {
|
|
// Turbopack config: redirect native modules to stubs at build time
|
|
turbopack: {
|
|
resolveAlias: {
|
|
// Point mitm/manager to a stub during build (native child_process/fs can't be bundled)
|
|
"@/mitm/manager": "./src/mitm/manager.stub.ts",
|
|
},
|
|
},
|
|
output: "standalone",
|
|
serverExternalPackages: [
|
|
"better-sqlite3",
|
|
"zod",
|
|
"child_process",
|
|
"fs",
|
|
"path",
|
|
"os",
|
|
"crypto",
|
|
"net",
|
|
"tls",
|
|
"http",
|
|
"https",
|
|
"stream",
|
|
"buffer",
|
|
"util",
|
|
],
|
|
transpilePackages: ["@omniroute/open-sse"],
|
|
allowedDevOrigins: ["localhost", "127.0.0.1", "192.168.*"],
|
|
typescript: {
|
|
// TODO: Re-enable after fixing all sub-component useTranslations scope issues
|
|
ignoreBuildErrors: true,
|
|
},
|
|
images: {
|
|
unoptimized: true,
|
|
},
|
|
webpack: (config, { isServer }) => {
|
|
// Ignore native Node.js modules in browser bundle
|
|
if (!isServer) {
|
|
config.resolve.fallback = {
|
|
...config.resolve.fallback,
|
|
fs: false,
|
|
path: false,
|
|
child_process: false,
|
|
net: false,
|
|
tls: false,
|
|
crypto: false,
|
|
};
|
|
}
|
|
return config;
|
|
},
|
|
async rewrites() {
|
|
return [
|
|
{
|
|
source: "/chat/completions",
|
|
destination: "/api/v1/chat/completions",
|
|
},
|
|
{
|
|
source: "/responses",
|
|
destination: "/api/v1/responses",
|
|
},
|
|
{
|
|
source: "/models",
|
|
destination: "/api/v1/models",
|
|
},
|
|
{
|
|
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 withNextIntl(nextConfig);
|