Skip to content

Commit 456589a

Browse files
committed
Limit the number of concurrently open file watchers on macos
There is a node.js bug on MacOS which causes closing file watchers to be really slow. nodejs/node#29949
1 parent 21eb54a commit 456589a

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

packages/next/src/cli/next-dev.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,11 @@ const nextDev = async (
291291
? startServerOptions.selfSignedCertificate.rootCA
292292
: defaultEnv.NODE_EXTRA_CA_CERTS,
293293
NODE_OPTIONS: formatNodeOptions(nodeOptions),
294+
// There is a node.js bug on MacOS which causes closing file watchers to be really slow.
295+
// This limits the number of watchers to mitigate the issue.
296+
// https://github.com/nodejs/node/issues/29949
297+
WATCHPACK_WATCHER_LIMIT:
298+
os.platform() === 'darwin' ? '20' : undefined,
294299
},
295300
})
296301

0 commit comments

Comments
 (0)