<p dir="auto"><strong>Do you want to request a <em>feature</em> or report a <em>bug</em>?</strong></p>
<p dir="auto">Bug</p>
<p dir="auto"><strong>What is the current behavior?</strong></p>
<p dir="auto">When importing an undefined named import, it doesn't produce any warning or error in build, but fail at runtime. I am using babel-preset-env, with <code class="notranslate">modules: false</code>.</p>
<p dir="auto"><strong>If the current behavior is a bug, please provide the steps to reproduce.</strong></p>
<p dir="auto">a.js</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import { getDef, getUndef } from './b.js';

getDef();     // works
getUndef();   // throws"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-kos">{</span> <span class="pl-s1">getDef</span><span class="pl-kos">,</span> <span class="pl-s1">getUndef</span> <span class="pl-kos">}</span> <span class="pl-k">from</span> <span class="pl-s">'./b.js'</span><span class="pl-kos">;</span>

<span class="pl-en">getDef</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>     <span class="pl-c">// works</span>
<span class="pl-en">getUndef</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>   <span class="pl-c">// throws</span></pre></div>
<p dir="auto">b.js</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="export const getDef = () =&gt; 'defined';"><pre class="notranslate"><span class="pl-k">export</span> <span class="pl-k">const</span> <span class="pl-en">getDef</span> <span class="pl-c1">=</span> <span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-s">'defined'</span><span class="pl-kos">;</span></pre></div>
<p dir="auto"><strong>What is the expected behavior?</strong></p>
<p dir="auto">I would expect webpack to produce an error, because the named import doesn't exist.</p>
<p dir="auto"><strong>If this is a feature request, what is motivation or use case for changing the behavior?</strong></p>
<p dir="auto">Got bit by this many times, and I think it should be a build check instead of a runtime check.</p>
<p dir="auto"><strong>Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System.</strong></p>
<p dir="auto">OS: MacOSX 10.13.2<br>
Node: 8.10.3<br>
Webpack: 3.10.0<br>
babel/preset-env: 7.0.0-beta.34</p>
<p dir="auto">Thanks in advance!</p>
<p dir="auto"><strong>I'm submitting a feature request</strong><br>
<strong>Webpack version:</strong><br>
2.1.0-beta.21</p>
<p dir="auto"><strong>Please tell us about your environment:</strong><br>
Linux</p>
<p dir="auto"><strong>Current behavior:</strong><br>
When I try to import a named import, it fails silently if the name import does not exist. I wish webpack would fail loudly when it cannot find the import at build time</p>
<p dir="auto">For example:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="// file1.js
const var1 = 'var1'
export { var1 }"><pre class="notranslate"><code class="notranslate">// file1.js
const var1 = 'var1'
export { var1 }
</code></pre></div>
<p dir="auto">and</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="// file2.js
import { var2 } from './file1'
// at this point, var2 is undefined at runtime because it was never exported from file1.js"><pre class="notranslate"><code class="notranslate">// file2.js
import { var2 } from './file1'
// at this point, var2 is undefined at runtime because it was never exported from file1.js
</code></pre></div>
<p dir="auto"><strong>Desired behavior:</strong><br>
Instead, I want it to fail at build time. Is there a webpack option or some other technique I can use to catch this error sooner?</p>
<ul dir="auto">
<li><strong>What is the motivation / use case for changing the behavior?</strong><br>
This will catch typos at build time, and prevent a lot of headaches caused by undefined imports.</li>
<li><strong>Browser:</strong> [all ]</li>
<li><strong>Language:</strong> [ES6/7]</li>
</ul>