web: restrict Next.js dev watcher to prevent EMFILE exhaustion

This commit is contained in:
kumarabhirup 2026-02-20 00:42:31 -08:00
parent b4502d7bc6
commit d86c4fb5b5
No known key found for this signature in database
GPG Key ID: DB7CA2289CAB0167

View File

@ -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;