diff --git a/ecmascript/codegen/src/lib.rs b/ecmascript/codegen/src/lib.rs index 3e8b394ef3ca..bd2378198e83 100644 --- a/ecmascript/codegen/src/lib.rs +++ b/ecmascript/codegen/src/lib.rs @@ -2493,6 +2493,10 @@ fn escape_with_source<'s>( s: &'s str, single_quote: Option, ) -> String { + if target <= JscTarget::Es5 { + return escape_without_source(s, target, single_quote.unwrap_or(false)); + } + if span.is_dummy() { return escape_without_source(s, target, single_quote.unwrap_or(false)); }