Skip to content

Commit 675f1f5

Browse files
committed
fix(@angular/build): avoid pure comment pattern in oxc transform
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
1 parent 12459ee commit 675f1f5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎packages/angular/build/src/tools/oxc/oxc-transform.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ export function transform(filename: string, code: string, options: OxcTransformO
599599
source.appendRight(classNode.start, `let ${classIdName} = /*#__PURE__*/ (() => {\n`);
600600
source.appendLeft(lastStatement.end, `\nreturn ${classIdName};\n})();`);
601601
} else if (isVariableClass) {
602-
// Wrap class inside init: `/*#__PURE__*/ (() => { let ClassName = class ClassName {}; return ClassName; })()`
602+
// 2. Wrap class inside init: `(() => { let ClassName = class ClassName {}; return ClassName; })()`
603603
source.appendRight(classNode.start, `/*#__PURE__*/ (() => {\nlet ${classIdName} = `);
604604
const terminator = activeWrapPaths.length === 0 ? ';' : '';
605605
const iifeClosing = activeWrapPaths.length === 0 ? '})()' : '})();';

0 commit comments

Comments
 (0)