Skip to content

Commit

Permalink
Limit the number of concurrently open file watchers on macos (#73741)
Browse files Browse the repository at this point in the history
### What?

This adds a workaround for a Node.js bug on MacOS which causes closing file watchers to be really slow:
nodejs/node#29949

It was fixed before here: #51826
But accidentically removed here: c5a8e09#diff-0ff576bd02e76f96680accff48ecbe4126a7f6bc4eafa547b6d44dee49bab770L88
  • Loading branch information
sokra authored Dec 10, 2024
1 parent 92b3dd2 commit 416c137
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/next/src/cli/next-dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,11 @@ const nextDev = async (
? startServerOptions.selfSignedCertificate.rootCA
: defaultEnv.NODE_EXTRA_CA_CERTS,
NODE_OPTIONS: formatNodeOptions(nodeOptions),
// There is a node.js bug on MacOS which causes closing file watchers to be really slow.
// This limits the number of watchers to mitigate the issue.
// https://github.com/nodejs/node/issues/29949
WATCHPACK_WATCHER_LIMIT:
os.platform() === 'darwin' ? '20' : undefined,
},
})

Expand Down

0 comments on commit 416c137

Please sign in to comment.