Open source CapCut alternative.
TypeScript
fix(site): keep the local-only Cut engine out of the hosted function bundle
David Le5d8618dc3247
diff --git a/site/next.config.ts b/site/next.config.tsindex 83bffe8c..88e96bae 100644--- a/site/next.config.ts+++ b/site/next.config.ts@@ -13,6 +13,14 @@ const nextConfig: NextConfig = {serverActions: { bodySizeLimit: "4gb" },proxyClientMaxBodySize: "4gb",},+ // Cut is local-only, so /api/cut/* 404s on a hosted deploy and never spawns the+ // Claude Agent SDK. Its platform CLI binary (~220MB, and unusable on Vercel's+ // runtime anyway) otherwise gets traced into the function and blows past+ // Vercel's 250MB limit. Drop the whole SDK binary family from every function's+ // trace; the /api/cut route returns 404 before the SDK is ever imported.+ outputFileTracingExcludes: {+ "/*": ["./node_modules/@anthropic-ai/claude-agent-sdk-*/**/*"],+ },};const withMDX = createMDX({diff --git a/site/src/app/api/cut/[[...slug]]/route.ts b/site/src/app/api/cut/[[...slug]]/route.tsindex 7c768f59..de19c705 100644--- a/site/src/app/api/cut/[[...slug]]/route.ts+++ b/site/src/app/api/cut/[[...slug]]/route.ts@@ -1,10 +1,22 @@-import { cutCatchAll } from "@/cut/server/http/next";+import { isHostedRuntime } from "@/cut/server/local-only";// The whole Cut API lives under /api/cut/* and routes through the shared table// (src/cut/server/http/routes.ts) — the same one the packaged engine mounts.+//+// Cut is local-only: on a hosted deploy every Cut API 404s. The 404 is returned+// here, before the dynamic import that pulls the router, so the engine's module+// graph — including the ~220MB Claude Agent SDK CLI binary that ai.ts imports —+// never loads on hosted. next.config's outputFileTracingExcludes then drops that+// binary from the deployed function so it fits Vercel's size limit.export const runtime = "nodejs";-export const GET = cutCatchAll;-export const POST = cutCatchAll;-export const PUT = cutCatchAll;-export const DELETE = cutCatchAll;+async function handle(req: Request): Promise<Response> {+ if (isHostedRuntime()) return new Response(null, { status: 404 });+ const { cutCatchAll } = await import("@/cut/server/http/next");+ return cutCatchAll(req);+}++export const GET = handle;+export const POST = handle;+export const PUT = handle;+export const DELETE = handle;