The code I have:
export function SomeComponent({captions}: {captions?: string[]}) {
const {firstConst, secondConst, thirdConst} = someVariable
const text = captions && captions[firstConst]
const max = secondConst - thirdConst
const digits = Math.max(2, String(max + 1).length)
//...more codes
}
However, when I try to minify, the code came out as:
function SomeComponent({
captions: e
}) {
var {
index: r,
total: o,
visible: a
} = t, e = e && e[r], o = o - a, a = Math.max(2, String(1 + o).length);
// ...more code
}
As you can see, I'll get error on e = e && e[r], o = o - a and a = Math.max(2, String(1 + o).length). The error message is:
Identifier 'e' has already been declared (14:48)
and so on...
The current uglify setting is just on default (with no custom settings)
UglifyJS.minify(code)