From 9ebc3e15ba6873130144080922f125b5916b6991 Mon Sep 17 00:00:00 2001 From: Boopathi Rajaa Date: Sat, 18 Feb 2017 23:42:28 +0100 Subject: [PATCH] Mark evalScopes for DCE (Fix #366) As DCE is a separate pass and we recalculate path and scope by clearing the path and scope caches, we need to mark evalscopes again for DCE --- .../babel-plugin-minify-dead-code-elimination/src/index.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/babel-plugin-minify-dead-code-elimination/src/index.js b/packages/babel-plugin-minify-dead-code-elimination/src/index.js index 80328f7ef..72849016e 100644 --- a/packages/babel-plugin-minify-dead-code-elimination/src/index.js +++ b/packages/babel-plugin-minify-dead-code-elimination/src/index.js @@ -1,7 +1,7 @@ "use strict"; const some = require("lodash.some"); -const { markEvalScopes, isMarked: isEvalScopesMarked, hasEval } = require("babel-helper-mark-eval-scopes"); +const { markEvalScopes, hasEval } = require("babel-helper-mark-eval-scopes"); function prevSiblings(path) { const parentPath = path.parentPath; @@ -773,9 +773,7 @@ module.exports = ({ types: t, traverse }) => { traverse.clearCache(); path.scope.crawl(); - if (!isEvalScopesMarked(path.scope)) { - markEvalScopes(path); - } + markEvalScopes(path); // We need to run this plugin in isolation. path.traverse(main, {