-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Labels
Description
Describe the bug
Mangler generates duplicated idents if there's eval.
The problem disappears if we comment memberValue = eval("");
Input code
var Config = function () {
if (chart.series) {
var specialUnit = {
ids: [],
};
var normalUnit = {
ids: [],
};
chart.series.forEach(function (item) {
var mId = item.split("-")[2];
specialUnit.ids.push(mId);
normalUnit.ids.push(mId);
});
}
memberValue = eval("");
}();
console.log(Config);Config
{
"jsc": {
"target": "es2024",
"parser": {
"syntax": "typescript",
"tsx": false
},
"transform": {
"legacyDecorator": false,
"decoratorVersion": "2022-03"
},
"minify": {
"compress": true,
"mangle": true,
},
"loose": false
},
"module": {
"type": "es6"
},
"minify": false,
"isModule": true,
}Link to the code that reproduces this issue
SWC Info output
No response
Expected behavior
It should not generate duplicated idents, which makes the program broken
Actual behavior
e and r are duplicated
var Config = function() {
if (chart.series) {
var e = [], r = [];
chart.series.forEach(function(e) {
var r = e.split("-")[2];
e.push(r), r.push(r);
});
}
memberValue = eval("");
}();
console.log(Config);Version
1.15.2
Additional context
No response