improve usability of mangle.properties (#5683)

fixes #5682
This commit is contained in:
Alex Lam S.L
2022-09-27 06:52:58 +01:00
committed by GitHub
parent 8e65413b99
commit 3fa2086681
7 changed files with 260 additions and 41 deletions

View File

@@ -205,15 +205,15 @@ describe("minify", function() {
'a["foo"]="bar",a.a="red",x={"bar":10};');
});
it("Should not mangle quoted property within dead code", function() {
var result = UglifyJS.minify('({ "keep": 1 }); g.keep = g.change;', {
var result = UglifyJS.minify('({ "keep": 1 }); g.keep = g.change = 42;', {
mangle: {
properties: {
keep_quoted: true
}
}
keep_quoted: true,
},
},
});
if (result.error) throw result.error;
assert.strictEqual(result.code, "g.keep=g.g;");
assert.strictEqual(result.code, "g.keep=g.g=42;");
});
});