Skip to content

[builder] Watch is not properly releasing on 'build' #45

@Aukevanoost

Description

@Aukevanoost

Bug: dev: true forces watch mode in ng build builder

Description

When the Native Federation ng build builder runs with dev: true, watch mode is activated regardless of the watch option. Passing watch: false alongside
dev: true is silently ignored, so the build never exits and continues running as a watcher.

Steps to reproduce

  1. Configure a project that uses @angular-architects/native-federation:build.
  2. Invoke the builder with dev: true and watch: false.
  3. Observe that the process does not terminate after the initial build and continues to react to file changes.

Expected behavior

watch: false should take precedence: the builder should perform a single dev build and exit. dev should only control whether dev-mode artifacts are
produced, not whether the builder watches for changes.

Actual behavior

The builder enables file watching and the rebuild loop whenever dev is truthy, ignoring watch: false.

Root cause

In packages/angular/src/builders/build/builder.ts, the watcher and rebuild branches are gated by nfBuilderOptions.dev || watch:

  - builder.ts:330 — nfBuilderOptions.dev || watch ? createNfWatcher() : undefined
  - builder.ts:406 — else if (!first && (nfBuilderOptions.dev || watch))

These should be gated on watch only (or dev && watch), so that an explicit watch: false disables the watch loop even in dev mode.

##Suggested fix

Replace the nfBuilderOptions.dev || watch checks with watch (the already-normalized value at builder.ts:150) so that watch is the single source of truth
for watch-mode activation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions