fix(es/minifier): Remove raw of strings after modification (#8865)

**Related issue:**

 - Closes #8864
This commit is contained in:
Donny/강동윤 2024-04-16 13:39:54 +09:00 committed by GitHub
parent af19385097
commit 740c0bb00a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 1 deletions

View File

@ -742,9 +742,10 @@ impl Pure<'_> {
};
self.changed = true;
report_change!("evaluate: Evaluated `{}` of a string literal", method);
report_change!("evaluate: Evaluated `{method}` of a string literal");
*e = Expr::Lit(Lit::Str(Str {
value: new_val.into(),
raw: None,
..s
}));
}

View File

@ -11193,3 +11193,22 @@ fn issue_8246_1() {
false,
);
}
#[test]
fn issue_8864_1() {
run_default_exec_test(
"
class Renderer {
renderStaticFrame(string1, string2) {
const line1Text = `${string1} and ${string2}`.toUpperCase();
const line2Text = 'line 2 text'.toUpperCase();
const text = `${line1Text}\n${line2Text}`;
return text;
}
}
console.log(new Renderer().renderStaticFrame('a', 'b'));
",
)
}