Skip to content

babel-plugin-minify-dead-code-elimination: produces wrong code #469

@jacott

Description

@jacott

version 0.1.4

from Babel REPL:

 function subList(list=[], template) {

      var olElm = template.element;

      if (olElm.tagName !== 'OL') {
        olElm = document.createElement('ol');
      } else {
        var reinsert = foo => list.push(olElm);
        var hash = {};
      }

      if (hash) {
        reinsert();
      }

      return olElm;
    }

produces:

function subList(a=[],b){
var c=b.element;
if('OL'!==c.tagName)
  c=document.createElement('ol');
else
  var d=()=>a.push(c);
return d(),c
}

hash is eliminated when it shouldn't be. This is a cut down version of the code that had the problem which is why it doesn't make much sense.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugConfirmed bughas PRHas an open PR that fixes this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions