Repository navigation
fix(@schematics/angular): keep existing worker tsconfig when generating another web worker - #34633
Merged
Merged
Conversation
…ng another web worker second `ng g web-worker` failed with `A merge conflicted on path "/tsconfig.worker.json"` in any workspace from `ng new` since 21.2.0, CLI formats first file with prettier and it no longer matches template config is shared by all workers of project, so it is now written only when file is missing
There was a problem hiding this comment.
Code Review
This pull request updates the Angular web-worker schematic to check if tsconfig.worker.json already exists before creating it, ensuring that existing configurations are not overwritten when adding multiple web workers to a project. A corresponding unit test has been added to verify this behavior. There are no review comments, and I have no feedback to provide.
alan-agius4
approved these changes
Nov 3, 2026
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Checklist
PR Type
What is the current behavior?
Issue Number: N/A
Second
ng g web-workerfails in any workspace fromng new,--forcedoes not help. Repro on 22.3.0-next.4:Schematic always merges its
tsconfig.worker.json, which worked only while file on disk was same as templateSince 21.2.0 new workspaces have prettier and CLI formats generated files, so first worker already leaves file diferent from template. Manual edit in that file gives same error
What is the new behavior?
Config is shared by all workers of project, so schematic writes it only when file is missing and existing one stays as is
New spec fails on main with same error
Does this PR introduce a breaking change?
Other information
Until 82c438b schematic skipped config when
webWorkerTsConfigwas already set. I went withtree.existsover bringing that back, option can be set with file missing and file can exist without option