Skip to content

fix(@angular/build): enforce library compilerOptions and skip app-only target warning - #34437

Merged
alan-agius4 merged 6 commits into
angular:mainfrom
alan-agius4:fix/library-compiler-options
Oct 20, 2026
Merged

alan-agius4 merged 6 commits into
angular:mainfrom
alan-agius4:fix/library-compiler-options

Conversation

@alan-agius4

@alan-agius4 alan-agius4 commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

Ensure library compilations explicitly set noEmit: false and emitDeclarationOnly: false in transformCompilerOptions so that configurations extending a root tsconfig.json with noEmit or emitDeclarationOnly still emit both JavaScript and declaration files.

Additionally, apply library compilerOptions overrides before the target < ES2022 check so the application-specific Browserslist warning and useDefineForClassFields = false fallback are skipped when compiling libraries.

….tsbuildinfo emit

Ensure library compilations explicitly set `noEmit: false`, `emitDeclarationOnly: false`, and `emitDecoratorMetadata: false` in `transformCompilerOptions` so that configurations extending a root `tsconfig.json` with `noEmit` or `emitDeclarationOnly` still emit both JavaScript and declaration files.

Additionally, skip the application-specific `target < ES2022` Browserslist warning and `useDefineForClassFields = false` fallback when compiling libraries, and avoid serializing and writing on-disk `.tsbuildinfo` files during library builds since library outputs are emitted into in-memory maps on cold builds and watch rebuilds reuse the in-memory `BuilderProgram` directly.
@alan-agius4 alan-agius4 changed the title fix(@angular/build): enforce library compilerOptions and skip unused .tsbuildinfo emit fix(@angular/build): enforce library compilerOptions and skip app-only target warning Oct 20, 2026
@alan-agius4
alan-agius4 requested a review from clydin October 20, 2026 11:21
@alan-agius4
alan-agius4 marked this pull request as ready for review October 20, 2026 11:21
@alan-agius4 alan-agius4 added action: review The PR is still awaiting reviews from at least one requested reviewer target: patch This PR is targeted for the next patch release labels Oct 20, 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 updates the compiler options transformation logic for Angular libraries. Specifically, it ensures that when building a library, options such as noEmit, emitDeclarationOnly, and emitDecoratorMetadata are explicitly overridden to false to ensure proper generation of both JavaScript and declaration files. Additionally, it skips the application-only target warning for libraries. Unit and behavior tests have been added to verify these behaviors. I have no feedback to provide as there are no review comments.

@alan-agius4 alan-agius4 added target: minor This PR is targeted for the next minor release and removed target: patch This PR is targeted for the next patch release labels Oct 20, 2026
Comment thread packages/angular/build/src/tools/angular/compilation/compiler-options.ts Outdated
Comment thread packages/angular/build/src/tools/angular/compilation/compiler-options.ts Outdated
@alan-agius4 alan-agius4 removed the action: review The PR is still awaiting reviews from at least one requested reviewer label Oct 20, 2026
@alan-agius4 alan-agius4 added the action: merge The PR is ready for merge by the caretaker label Oct 20, 2026
@alan-agius4
alan-agius4 merged commit 566abde into angular:main Oct 20, 2026
40 checks passed
@alan-agius4

Copy link
Copy Markdown
Collaborator Author

This PR was merged into the repository. The changes were merged into the following branches:

@alan-agius4
alan-agius4 deleted the fix/library-compiler-options branch October 20, 2026 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: @angular/build target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants