Skip to content

feat(@angular/build): add opt-in manual rebuild mode to the dev-server#33330

Open
fhackenberger wants to merge 1 commit into
angular:mainfrom
fhackenberger:main
Open

feat(@angular/build): add opt-in manual rebuild mode to the dev-server#33330
fhackenberger wants to merge 1 commit into
angular:mainfrom
fhackenberger:main

Conversation

@fhackenberger

Copy link
Copy Markdown

Add a manualRebuild option to the @angular/build:dev-server builder that pauses automatic rebuilds while keeping the development server live and serving the last successful build. Previously every file change triggered an immediate rebuild and reload, which is costly when making a series of edits.

While paused, file-change events are buffered in memory and coalesced per path so redundant events for the same file collapse to a single net change. Touching the trigger file (rebuildTrigger, defaulting to .ng-rebuild) flushes the queue to the build system as one incremental rebuild, after which the server performs a single HMR/live-reload cycle.

PR Checklist

Please check to confirm your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

The current ng serve listens to all changes to files. Coding with LLM agents often means files are touched at a faster pace than manual coding, so it makes sense to have a hot dev server that is triggered when the agent is done with one task and wants to check the build.

Issue Number: N/A

What is the new behavior?

With the two new options, you can have ng serve queue up modifications to the code base and trigger a build, by touching a configurable trigger file.

Does this PR introduce a breaking change?

  • Yes
  • No

Add a `manualRebuild` option to the `@angular/build:dev-server` builder
that pauses automatic rebuilds while keeping the development server live
and serving the last successful build. Previously every file change
triggered an immediate rebuild and reload, which is costly when making a
series of edits.

While paused, file-change events are buffered in memory and coalesced
per path so redundant events for the same file collapse to a single net
change. Touching the trigger file (`rebuildTrigger`, defaulting to
`.ng-rebuild`) flushes the queue to the build system as one incremental
rebuild, after which the server performs a single HMR/live-reload cycle.
@angular-robot angular-robot Bot added detected: feature PR contains a feature commit area: @angular/build labels Jun 9, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a manual rebuild mode for the Angular build watch loop, allowing automatic rebuilds to be paused and buffered until a specific trigger file (defaulting to .ng-rebuild) is touched. The changes include adding manualRebuild and rebuildTrigger options, updating the esbuild build action to buffer and coalesce file changes, and adding comprehensive tests. The review feedback highlights an improvement opportunity: when checking if the trigger file has been touched, the code should check both batch.modified and batch.added to ensure the rebuild is reliably triggered even if the file is newly created or recreated.

if (manualRebuildTrigger) {
// While paused, buffer and coalesce incoming changes; only the trigger file's
// modification flushes the queue and drives a single incremental rebuild.
const flush = batch.modified.has(manualRebuildTrigger);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

If the trigger file is created for the first time (or recreated after being deleted), the file watcher might report it as an added event rather than a modified event. To ensure the manual rebuild is reliably triggered in all cases, we should check both batch.modified and batch.added for the trigger file.

Suggested change
const flush = batch.modified.has(manualRebuildTrigger);
const flush = batch.modified.has(manualRebuildTrigger) || batch.added.has(manualRebuildTrigger);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: @angular/build detected: feature PR contains a feature commit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant