diff --git a/packages/babel-plugin-minify-dead-code-elimination/src/remove-use-strict.js b/packages/babel-plugin-minify-dead-code-elimination/src/remove-use-strict.js index 64fe4a430..81e4b6033 100644 --- a/packages/babel-plugin-minify-dead-code-elimination/src/remove-use-strict.js +++ b/packages/babel-plugin-minify-dead-code-elimination/src/remove-use-strict.js @@ -50,7 +50,10 @@ function isStrict(block) { } function getUseStrictDirectives(block) { - return block.get("directives").filter(directive => { - return directive.node.value.value === useStrict; - }); + var dir = block.get("directives"); + return Array.isArray(dir) + ? dir.filter(function(directive) { + return directive.node.value.value === useStrict; + }) + : []; }