Decreased watchpack aggregate timeout (#54461)
This decreases the aggregate event timeout for WatchPack in development to `5ms` which should improve the performance of reloading routes for users developing Next.js applications.
This commit is contained in:
parent
758b9d251a
commit
7363bf4354
1 changed files with 8 additions and 0 deletions
|
@ -87,6 +87,13 @@ import { MiddlewareManifest } from '../../../build/webpack/plugins/middleware-pl
|
|||
import { devPageFiles } from '../../../build/webpack/plugins/next-types-plugin/shared'
|
||||
import type { RenderWorkers } from '../router-server'
|
||||
|
||||
/**
|
||||
* This is the timeout for which the watchpack will emit the `aggregate` event
|
||||
* after file changes are made. This is to prevent unnecessary rebuilds when
|
||||
* multiple files are changed at once.
|
||||
*/
|
||||
const WATCHPACK_AGGREGATE_TIMEOUT = 5
|
||||
|
||||
type SetupOpts = {
|
||||
renderWorkers: RenderWorkers
|
||||
dir: string
|
||||
|
@ -780,6 +787,7 @@ async function startWatcher(opts: SetupOpts) {
|
|||
files.push(...tsconfigPaths)
|
||||
|
||||
const wp = new Watchpack({
|
||||
aggregateTimeout: WATCHPACK_AGGREGATE_TIMEOUT,
|
||||
ignored: (pathname: string) => {
|
||||
return (
|
||||
!files.some((file) => file.startsWith(pathname)) &&
|
||||
|
|
Loading…
Reference in a new issue