Uglifyjs: [bug] false positive unused code detection leads to removing useful code

Created on 12 Mar 2018  路  2Comments  路  Source: mishoo/UglifyJS

Bug report or feature request?
Bug

ES5 or ES6+ input?
ES5

Uglify version (uglifyjs -V)
3.3.12, 3.3.13, 3.3.14
Bug appears at 3.3.12
JavaScript input

someGlobalFuncLikeWebpackJsonP(1, {
    a: (function(module, exports) {
        module.exports = exports = function test() {return 42;}
        exports.test2 = function test2() {return 24;}
    })
});

The uglifyjs CLI command executed or minify() options used.

uglifyjs -c -m test.js

JavaScript output or error produced.

method test2 is missing

someGlobalFuncLikeWebpackJsonP(1,{a:function(n,o){n.exports=function(){return 42}}});

Expected code

UglifyJS 3.3.9 outputs correct code

someGlobalFuncLikeWebpackJsonP(1,{a:function(n,t){n.exports=t=function(){return 42},t.test2=function(){return 24}}});
bug

Most helpful comment

@alexlamsl less than day to fix. You are awesome!

All 2 comments

Thanks for the detailed report - investigating.

@alexlamsl less than day to fix. You are awesome!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kzc picture kzc  路  5Comments

buu700 picture buu700  路  5Comments

Jimbly picture Jimbly  路  4Comments

pvdz picture pvdz  路  3Comments

neverfox picture neverfox  路  4Comments