diff --git a/src/babel/transformation/transformers/utility/dead-code-elimination.js b/src/babel/transformation/transformers/utility/dead-code-elimination.js index c25c1e4266..a8e4430dbe 100644 --- a/src/babel/transformation/transformers/utility/dead-code-elimination.js +++ b/src/babel/transformation/transformers/utility/dead-code-elimination.js @@ -77,7 +77,7 @@ export var IfStatement = { // if (foo) {} else { bar; } -> if (!foo) { bar; } // - if (t.blockStatement(consequent) && consequent.body && !consequent.body.length && t.isBlockStatement(alternate) && alternate.body && alternate.body.length) { + if (t.isBlockStatement(consequent) && !consequent.body.length && t.isBlockStatement(alternate) && alternate.body.length) { node.consequent = node.alternate; node.alternate = null; node.test = t.unaryExpression("!", test, true);