Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decreased watchpack aggregate timeout #54461

Merged
merged 3 commits into from
Aug 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/next/src/server/lib/router-utils/setup-dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)) &&
Expand Down