fix(@angular/build): apply file replacements to web worker entry bundles by maruthang · Pull Request #32930 · angular/angular-cli

added 2 commits

April 2, 2026 19:45
In npm/pnpm/yarn workspace setups, the package manager's list command runs
against the workspace root and may not include packages that are only declared
in a workspace member's package.json.  This caused ng update to report
"Package X is not a dependency" for packages installed in a workspace member
even though they were present and installed.

The fix reads the Angular project root's package.json directly and resolves any
declared dependencies that are resolvable from node_modules but were absent from
the package manager's output.  This restores the behaviour that was present
before the package-manager abstraction was introduced.

Closes angular#32787
The esbuild synchronous API used for worker sub-builds does not support
plugins, which are the mechanism through which file replacements are
applied in the main application bundle. As a result, fileReplacements
entries were silently ignored when bundling web workers.

Fix this by rewriting the worker entry file's import specifiers before
passing the content to buildSync. Each relative specifier is resolved to
an absolute path and compared against the fileReplacements map; matching
specifiers are replaced with the absolute path of the replacement file.
The worker is then bundled via stdin so that esbuild resolves and bundles
the replacement files normally.

Also handle the case where the worker entry file itself is replaced, and
ensure that rebuild file-tracking correctly excludes the synthetic stdin
entry added by esbuild to the metafile while still tracking the original
worker source file.

Closes angular#29546

gemini-code-assist[bot]

@maruthang

…nterpolation

Use a callback function in String.replace() to prevent special
replacement patterns ($&, $', etc.) from being interpreted when
a file replacement path contains dollar-sign characters.