From d86c4fb5b59adae9bf303c04eca54c3aebfa75b5 Mon Sep 17 00:00:00 2001 From: kumarabhirup Date: Fri, 20 Feb 2026 00:42:31 -0800 Subject: [PATCH] web: restrict Next.js dev watcher to prevent EMFILE exhaustion --- apps/web/next.config.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/apps/web/next.config.ts b/apps/web/next.config.ts index 4ebd2876ceb..b59de57349d 100644 --- a/apps/web/next.config.ts +++ b/apps/web/next.config.ts @@ -1,5 +1,6 @@ import type { NextConfig } from "next"; import path from "node:path"; +import { homedir } from "node:os"; const nextConfig: NextConfig = { // Produce a self-contained standalone build so npm global installs @@ -17,6 +18,23 @@ const nextConfig: NextConfig = { // Transpile ESM-only packages so webpack can bundle them transpilePackages: ["react-markdown", "remark-gfm"], + + webpack: (config, { dev }) => { + if (dev) { + config.watchOptions = { + ...config.watchOptions, + ignored: [ + "**/node_modules/**", + "**/.git/**", + "**/dist/**", + "**/.next/**", + path.join(homedir(), ".openclaw", "**"), + ], + poll: 1500, + }; + } + return config; + }, }; export default nextConfig;