Skip to content

fix(@angular/build): prevent incorrect catch binding removal in downleveled for-await#32307

Merged
clydin merged 1 commit intoangular:mainfrom
clydin:application/esbuild-for-await
Jan 16, 2026
Merged

fix(@angular/build): prevent incorrect catch binding removal in downleveled for-await#32307
clydin merged 1 commit intoangular:mainfrom
clydin:application/esbuild-for-await

Conversation

@clydin
Copy link
Member

@clydin clydin commented Jan 15, 2026

When async-await is disabled (e.g., in Zone.js applications) and the build target is ES2019 or higher, esbuild may incorrectly remove the catch binding of a downleveled for await...of loop during minification.

This change explicitly disables the optional-catch-binding feature in esbuild when async-await support is disabled, forcing esbuild to retain the catch binding and avoiding the minification bug.

Closes #32298

…eveled for-await

When `async-await` is disabled (e.g., in Zone.js applications) and the build target is ES2019 or higher, esbuild may incorrectly remove the catch binding of a downleveled `for await...of` loop during minification.

This change explicitly disables the `optional-catch-binding` feature in esbuild when `async-await` support is disabled, forcing esbuild to retain the catch binding and avoiding the minification bug.

A new integration test has been added to verify that the catch binding is preserved in the optimized output.
@clydin clydin added the target: patch This PR is targeted for the next patch release label Jan 15, 2026
@clydin clydin added the action: review The PR is still awaiting reviews from at least one requested reviewer label Jan 15, 2026
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Jan 16, 2026
@clydin clydin merged commit d87f243 into angular:main Jan 16, 2026
38 checks passed
@clydin
Copy link
Member Author

clydin commented Jan 16, 2026

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

@clydin clydin deleted the application/esbuild-for-await branch January 16, 2026 14:35
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Feb 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Builder produces wrong minified code.

2 participants