Skip to content

fix(@angular/build): avoid pure comment pattern in oxc transform - #34013

Merged
alan-agius4 merged 1 commit into
angular:mainfrom
alan-agius4:fix-oxc-bun-comment
Sep 3, 2026
Merged

fix(@angular/build): avoid pure comment pattern in oxc transform#34013
alan-agius4 merged 1 commit into
angular:mainfrom
alan-agius4:fix-oxc-bun-comment

Conversation

@alan-agius4

Copy link
Copy Markdown
Collaborator

In Bun 1.4.0, single-line comments containing /*#__PURE__*/ immediately preceding a call expression cause Bun's lexer/transpiler to interpret the call as pure and drop it during dead code elimination when its return value is unused.

Sanitizing the comment avoids triggering this upstream Bun bug.

Fixes #33973

@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 simplifies a comment in packages/angular/build/src/tools/oxc/oxc-transform.ts by replacing a detailed IIFE code snippet description with the term 'IIFE'. There are no review comments, and I have no feedback to provide.

@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 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 Sep 3, 2026
source.appendLeft(lastStatement.end, `\nreturn ${classIdName};\n})();`);
} else if (isVariableClass) {
// Wrap class inside init: `/*#__PURE__*/ (() => { let ClassName = class ClassName {}; return ClassName; })()`
// Wrap class inside init: IIFE

@clydin clydin Sep 3, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do

// Wrap class inside init: `(() => { let ClassName = class ClassName {}; return ClassName; })()`

to keep the example structure?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

@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 Sep 3, 2026
In Bun 1.4.0, single-line comments containing `/*#__PURE__*/` immediately preceding a call expression cause Bun's lexer/transpiler to interpret the call as pure and drop it during dead code elimination when its return value is unused.

Sanitizing the comment avoids triggering this upstream Bun bug.

Fixes angular#33973
@alan-agius4
alan-agius4 merged commit 675f1f5 into angular:main Sep 3, 2026
10 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-oxc-bun-comment branch September 3, 2026 12:58
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

2 participants