<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have searched the <a href="https://github.com/zeit/next.js/issues">issues</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<h2 dir="auto">Expected Behavior</h2>
<p dir="auto">The <code class="notranslate">import()</code> promise returns the entire module, including <code class="notranslate">default</code>.</p>
<h2 dir="auto">Current Behavior</h2>
<p dir="auto">The <code class="notranslate">import()</code> promise returns the <code class="notranslate">default</code> export if it exists; otherwise, it returns the entire module. This breaks the spec-compliant method of loading default exports:</p>
<p dir="auto"><code class="notranslate">import('/some-module').then(module =&gt; module.default);</code></p>
<h2 dir="auto">Steps to Reproduce (for bugs)</h2>
<p dir="auto"><a href="https://repro-ilvgtolutc.now.sh" rel="nofollow">https://repro-ilvgtolutc.now.sh</a><br>
<a href="https://github.com/tptee/nextjs-import-spec-repro">https://github.com/tptee/nextjs-import-spec-repro</a></p>
<h2 dir="auto">Context</h2>
<p dir="auto">I'm trying to create examples for my library that uses <code class="notranslate">import()</code>, and <code class="notranslate">next</code>'s behavior is surprising compared to CRA and custom setups. Ensuring spec compliance would allow examples to apply everywhere and be shareable across environments.</p>
<p dir="auto">These lines in the <code class="notranslate">handle-import</code> Babel plugin seem to be the offenders:</p>
<ul dir="auto">
<li><a href="https://github.com/zeit/next.js/blob/v3-beta/server/build/babel/plugins/handle-import.js#L16">https://github.com/zeit/next.js/blob/v3-beta/server/build/babel/plugins/handle-import.js#L16</a></li>
<li><a href="https://github.com/zeit/next.js/blob/v3-beta/server/build/babel/plugins/handle-import.js#L26">https://github.com/zeit/next.js/blob/v3-beta/server/build/babel/plugins/handle-import.js#L26</a></li>
<li><a href="https://github.com/zeit/next.js/blob/v3-beta/server/build/babel/plugins/handle-import.js#L32">https://github.com/zeit/next.js/blob/v3-beta/server/build/babel/plugins/handle-import.js#L32</a></li>
</ul>
<p dir="auto">Happy to PR a fix, although it'll likely be a breaking change and (maybe) a usability loss.</p>
<h2 dir="auto">Your Environment</h2>
<table role="table">
<thead>
<tr>
<th>Tech</th>
<th>Version</th>
</tr>
</thead>
<tbody>
<tr>
<td>next</td>
<td>v3.0.1-beta.17</td>
</tr>
<tr>
<td>node</td>
<td>v7.9.0</td>
</tr>
<tr>
<td>OS</td>
<td>macOS 10.12.5</td>
</tr>
<tr>
<td>browser</td>
<td>Chrome 60.0.3112.50 (Official Build) beta (64-bit)</td>
</tr>
</tbody>
</table>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have searched the <a href="https://github.com/zeit/next.js/issues">issues</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<p dir="auto">I just started using Next.js and so far I've been blown away by the combination of features and simplicity.</p>
<p dir="auto">I'd like to donate in some way. How should I go about doing that? An <a href="https://opencollective.com/" rel="nofollow">Open Collective</a>, maybe?</p>