diff --git a/crates/oxc_codegen/src/gen.rs b/crates/oxc_codegen/src/gen.rs index fdb9c49a9dff8..0b6314b7548db 100644 --- a/crates/oxc_codegen/src/gen.rs +++ b/crates/oxc_codegen/src/gen.rs @@ -1482,6 +1482,9 @@ impl GenExpr for ObjectExpression<'_> { let is_multi_line = len > 1; let wrap = p.start_of_stmt == n || p.start_of_arrow_expr == n; p.wrap(wrap, |p| { + // Print comments for lingui https://lingui.dev/ref/macro#definemessage + // `const message = /*i18n*/ { };` + p.print_leading_comments(self.span.start); p.add_source_mapping(self.span); p.print_ascii_byte(b'{'); if is_multi_line { diff --git a/crates/oxc_codegen/tests/integration/comments.rs b/crates/oxc_codegen/tests/integration/comments.rs index 82b3beadad137..a844865dc7778 100644 --- a/crates/oxc_codegen/tests/integration/comments.rs +++ b/crates/oxc_codegen/tests/integration/comments.rs @@ -3,6 +3,8 @@ use crate::tester::test_same; #[test] fn unit() { test_same("