diff --git a/next.config.ts b/next.config.ts index 03e59f8..a2e96ff 100644 --- a/next.config.ts +++ b/next.config.ts @@ -1,3 +1,4 @@ +import path from "node:path"; import type { NextConfig } from "next"; /** @@ -49,6 +50,16 @@ const securityHeaders = [ const nextConfig: NextConfig = { poweredByHeader: false, reactStrictMode: true, + // Pin Turbopack's filesystem root to THIS app's directory. Without this, + // Next 16 walks up to the parent civi-webform/ workspace (it sees two + // package-lock.json files and silently picks the outer one), which causes + // Turbopack to watch the parent node_modules/, .claude-flow/, .swarm/, and + // ruvector.db. Background writes in those trees trigger a recompile loop: + // compile → write .next/dev → re-trigger → memory blows up. The build-time + // warning surfaces the same issue. + turbopack: { + root: path.resolve(__dirname), + }, async headers() { return [{ source: "/:path*", headers: securityHeaders }]; },