<h2 dir="auto">Bug Report</h2>
<p dir="auto"><strong>Current Behavior</strong></p>
<p dir="auto">an exception occurs when instrumenting valid JavaScript syntax.</p>
<p dir="auto"><strong>Input Code</strong></p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="function apple() {}
apple.prototype.foo = function foo () {
  let foo = 99
  console.info(foo)
}
apple.prototype.foo()"><pre class="notranslate"><span class="pl-k">function</span> <span class="pl-en">apple</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span><span class="pl-kos">}</span>
<span class="pl-s1">apple</span><span class="pl-kos">.</span><span class="pl-c1">prototype</span><span class="pl-kos">.</span><span class="pl-en">foo</span> <span class="pl-c1">=</span> <span class="pl-k">function</span> <span class="pl-en">foo</span> <span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-k">let</span> <span class="pl-s1">foo</span> <span class="pl-c1">=</span> <span class="pl-c1">99</span>
  <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">info</span><span class="pl-kos">(</span><span class="pl-s1">foo</span><span class="pl-kos">)</span>
<span class="pl-kos">}</span>
<span class="pl-s1">apple</span><span class="pl-kos">.</span><span class="pl-c1">prototype</span><span class="pl-kos">.</span><span class="pl-en">foo</span><span class="pl-kos">(</span><span class="pl-kos">)</span></pre></div>
<p dir="auto"><g-emoji class="g-emoji" alias="point_up" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/261d.png">☝️</g-emoji> the above code results in the following exception:</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="TypeError: Cannot read property 'file' of undefined
    at Scope.checkBlockScopedCollisions (/Users/benjamincoe/oss/node/node_modules/nyc/node_modules/babel-traverse/lib/scope/index.js:398:22)
    at Scope.registerBinding (/Users/benjamincoe/oss/node/node_modules/nyc/node_modules/babel-traverse/lib/scope/index.js:592:16)
    at Scope.registerDeclaration (/Users/benjamincoe/oss/node/node_modules/nyc/node_modules/babel-traverse/lib/scope/index.js:496:14)
    at Object.BlockScoped (/Users/benjamincoe/oss/node/node_modules/nyc/node_modules/babel-traverse/lib/scope/index.js:244:28)
    at Object.newFn (/Users/benjamincoe/oss/node/node_modules/nyc/node_modules/babel-traverse/lib/visitors.js:318:17)
    at NodePath._call (/Users/benjamincoe/oss/node/node_modules/nyc/node_modules/babel-traverse/lib/path/context.js:76:18)
    at NodePath.call (/Users/benjamincoe/oss/node/node_modules/nyc/node_modules/babel-traverse/lib/path/context.js:44:14)
    at NodePath.visit (/Users/benjamincoe/oss/node/node_modules/nyc/node_modules/babel-traverse/lib/path/context.js:105:12)
    at TraversalContext.visitQueue (/Users/benjamincoe/oss/node/node_modules/nyc/node_modules/babel-traverse/lib/context.js:150:16)
    at TraversalContext.visitMultiple (/Users/benjamincoe/oss/node/node_modules/nyc/node_modules/babel-traverse/lib/context.js:103:17)"><pre class="notranslate">TypeError: Cannot <span class="pl-c1">read</span> property <span class="pl-s"><span class="pl-pds">'</span>file<span class="pl-pds">'</span></span> of undefined
    at Scope.checkBlockScopedCollisions (/Users/benjamincoe/oss/node/node_modules/nyc/node_modules/babel-traverse/lib/scope/index.js:398:22)
    at Scope.registerBinding (/Users/benjamincoe/oss/node/node_modules/nyc/node_modules/babel-traverse/lib/scope/index.js:592:16)
    at Scope.registerDeclaration (/Users/benjamincoe/oss/node/node_modules/nyc/node_modules/babel-traverse/lib/scope/index.js:496:14)
    at Object.BlockScoped (/Users/benjamincoe/oss/node/node_modules/nyc/node_modules/babel-traverse/lib/scope/index.js:244:28)
    at Object.newFn (/Users/benjamincoe/oss/node/node_modules/nyc/node_modules/babel-traverse/lib/visitors.js:318:17)
    at NodePath._call (/Users/benjamincoe/oss/node/node_modules/nyc/node_modules/babel-traverse/lib/path/context.js:76:18)
    at NodePath.call (/Users/benjamincoe/oss/node/node_modules/nyc/node_modules/babel-traverse/lib/path/context.js:44:14)
    at NodePath.visit (/Users/benjamincoe/oss/node/node_modules/nyc/node_modules/babel-traverse/lib/path/context.js:105:12)
    at TraversalContext.visitQueue (/Users/benjamincoe/oss/node/node_modules/nyc/node_modules/babel-traverse/lib/context.js:150:16)
    at TraversalContext.visitMultiple (/Users/benjamincoe/oss/node/node_modules/nyc/node_modules/babel-traverse/lib/context.js:103:17)</pre></div>
<p dir="auto"><strong>Expected behavior/code</strong></p>
<p dir="auto">no exception occurs during instrumentation.</p>
<p dir="auto"><strong>Environment</strong></p>
<ul dir="auto">
<li>Babel version(s): [e.g. v6]</li>
<li>Node/npm version: [e.g. Node 8/npm 5]</li>
<li>OS: [e.g. OSX 10.13.4, Windows 10]</li>
<li>Monorepo [e.g. yes/no/Lerna]</li>
<li>How you are using Babel: [e.g. <code class="notranslate">programmatically</code>]</li>
</ul>
<p dir="auto"><strong>Possible Solution</strong></p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="
    var duplicate = kind === &quot;let&quot; || local.kind === &quot;let&quot; || local.kind === &quot;const&quot; || local.kind === &quot;module&quot; || local.kind === &quot;param&quot; &amp;&amp; (kind === &quot;let&quot; || kind === &quot;const&quot;);

    if (duplicate) {
      throw this.hub.file.buildCodeFrameError(id, messages.get(&quot;scopeDuplicateDeclaration&quot;, name), TypeError);
    }"><pre class="notranslate">    <span class="pl-k">var</span> <span class="pl-s1">duplicate</span> <span class="pl-c1">=</span> <span class="pl-s1">kind</span> <span class="pl-c1">===</span> <span class="pl-s">"let"</span> <span class="pl-c1">||</span> <span class="pl-s1">local</span><span class="pl-kos">.</span><span class="pl-c1">kind</span> <span class="pl-c1">===</span> <span class="pl-s">"let"</span> <span class="pl-c1">||</span> <span class="pl-s1">local</span><span class="pl-kos">.</span><span class="pl-c1">kind</span> <span class="pl-c1">===</span> <span class="pl-s">"const"</span> <span class="pl-c1">||</span> <span class="pl-s1">local</span><span class="pl-kos">.</span><span class="pl-c1">kind</span> <span class="pl-c1">===</span> <span class="pl-s">"module"</span> <span class="pl-c1">||</span> <span class="pl-s1">local</span><span class="pl-kos">.</span><span class="pl-c1">kind</span> <span class="pl-c1">===</span> <span class="pl-s">"param"</span> <span class="pl-c1">&amp;&amp;</span> <span class="pl-kos">(</span><span class="pl-s1">kind</span> <span class="pl-c1">===</span> <span class="pl-s">"let"</span> <span class="pl-c1">||</span> <span class="pl-s1">kind</span> <span class="pl-c1">===</span> <span class="pl-s">"const"</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

    <span class="pl-k">if</span> <span class="pl-kos">(</span><span class="pl-s1">duplicate</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
      <span class="pl-k">throw</span> <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">hub</span><span class="pl-kos">.</span><span class="pl-c1">file</span><span class="pl-kos">.</span><span class="pl-en">buildCodeFrameError</span><span class="pl-kos">(</span><span class="pl-s1">id</span><span class="pl-kos">,</span> <span class="pl-s1">messages</span><span class="pl-kos">.</span><span class="pl-en">get</span><span class="pl-kos">(</span><span class="pl-s">"scopeDuplicateDeclaration"</span><span class="pl-kos">,</span> <span class="pl-s1">name</span><span class="pl-kos">)</span><span class="pl-kos">,</span> <span class="pl-v">TypeError</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-kos">}</span></pre></div>
<p dir="auto">☝️ this logic seems a little bit wonky in general, why is "let" being checked for in the left-hand-side of the OR and not "const" for starters.</p>
<h3 dir="auto"><g-emoji class="g-emoji" alias="computer" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f4bb.png">💻</g-emoji></h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Would you like to work on a fix?</li>
</ul>
<h3 dir="auto">How are you using Babel?</h3>
<p dir="auto">@rollup/plugin-babel</p>
<h3 dir="auto">Input code</h3>
<p dir="auto">Cannot find module './data/corejs3-shipped-proposals.json'</p>
<h3 dir="auto">Configuration file name</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Configuration</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Current and expected behavior</h3>
<p dir="auto">Cannot find module './data/corejs3-shipped-proposals.json'</p>
<h3 dir="auto">Environment</h3>
<p dir="auto">7.21.5</p>
<h3 dir="auto">Possible solution</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Additional context</h3>
<p dir="auto"><em>No response</em></p>