NUglify icon indicating copy to clipboard operation
NUglify copied to clipboard

functions pruned when exported in an object literal

Open davethieben opened this issue 1 year ago • 1 comments

version: 1.20.7 (through LigerShark.WebOptimizer v3.0.396)

Describe the bug if RemoveUnneededCode = true, local functions are being pruned even they are referenced from an object literal export

To Reproduce invoking:

    var uglifyResult = NUglify.Uglify.Js(@"
function abc(def){
    alert(def);
}

export default { abc };
");
    Debug.WriteLine($"result:\r\n{uglifyResult.Code}");

Minified output or stack trace

export default{abc:n}

Excepted output code

function n(n){alert(n)}export default{abc:n}

which is what you get if you set RemoveUnneededCode = false

davethieben avatar Feb 22 '24 18:02 davethieben