Skip to content

Commit

Permalink
Merge pull request #1291 from sciyoshi/patch-1
Browse files Browse the repository at this point in the history
Don't register bindings for declarations with no output
  • Loading branch information
theKashey committed Jul 6, 2019
2 parents 19824db + 6064dd9 commit be4ed21
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/babel.dev.js
Expand Up @@ -77,7 +77,7 @@ function plugin(args, options = {}) {
// Try our best to avoid variables from require().
// Ideally we only want to find components defined by the user.
function shouldRegisterBinding(binding) {
const { type, node } = binding.path;
const { type, node, parent } = binding.path;
switch (type) {
case 'FunctionDeclaration':
case 'ClassDeclaration':
Expand All @@ -88,6 +88,9 @@ function plugin(args, options = {}) {
if (t.isCallExpression(init) && init.callee.name === 'require') {
return false;
}
if (parent.declare) {
return false;
}
return true;
}
default:
Expand Down

0 comments on commit be4ed21

Please sign in to comment.