<p dir="auto"><strong>Do you want to request a <em>feature</em> or report a <em>bug</em>?</strong><br>
BUG</p>

<p dir="auto"><strong>What is the current behavior?</strong><br>
I have the following ES6 module:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="export const namedExport1 = 'foo';
export const namedExport2 = 'bar';

const Test = function Test() {

  const factory = {
    foo: 'bar',
  };

  factory.sayHello = function sayHello(name) {
    alert(`Hello ${name}`);
  };

  return factory;
};

export default Test;"><pre class="notranslate"><span class="pl-k">export</span> <span class="pl-k">const</span> <span class="pl-s1">namedExport1</span> <span class="pl-c1">=</span> <span class="pl-s">'foo'</span><span class="pl-kos">;</span>
<span class="pl-k">export</span> <span class="pl-k">const</span> <span class="pl-s1">namedExport2</span> <span class="pl-c1">=</span> <span class="pl-s">'bar'</span><span class="pl-kos">;</span>

<span class="pl-k">const</span> <span class="pl-v">Test</span> <span class="pl-c1">=</span> <span class="pl-k">function</span> <span class="pl-v">Test</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>

  <span class="pl-k">const</span> <span class="pl-s1">factory</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span>
    <span class="pl-c1">foo</span>: <span class="pl-s">'bar'</span><span class="pl-kos">,</span>
  <span class="pl-kos">}</span><span class="pl-kos">;</span>

  <span class="pl-s1">factory</span><span class="pl-kos">.</span><span class="pl-en">sayHello</span> <span class="pl-c1">=</span> <span class="pl-k">function</span> <span class="pl-en">sayHello</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-en">alert</span><span class="pl-kos">(</span><span class="pl-s">`Hello <span class="pl-s1"><span class="pl-kos">${</span><span class="pl-s1">name</span><span class="pl-kos">}</span></span>`</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-kos">}</span><span class="pl-kos">;</span>

  <span class="pl-k">return</span> <span class="pl-s1">factory</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span><span class="pl-kos">;</span>

<span class="pl-k">export</span> <span class="pl-k">default</span> <span class="pl-v">Test</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">If I import it as <code class="notranslate">import myModule from 'path/Test'</code> and it is located in the node_modules directory, it gets imported as:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
  default: Test()
  namedExport1: 'foo'
  namedExport2: 'bar'
}"><pre class="notranslate"><span class="pl-kos">{</span>
  default: <span class="pl-v">Test</span><span class="pl-kos">(</span><span class="pl-kos">)</span>
  namedExport1: <span class="pl-s">'foo'</span>
  namedExport2: <span class="pl-s">'bar'</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">However, if I load the module from any other directory, it gets imported as the default method:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="function Test() {

  var factory = {
    foo: 'bar'
  };

  factory.sayHello = function sayHello(name) {
    alert('Hello ' + name);
  };

  return factory;
}"><pre class="notranslate"><span class="pl-k">function</span> <span class="pl-v">Test</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>

  <span class="pl-k">var</span> <span class="pl-s1">factory</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span>
    <span class="pl-c1">foo</span>: <span class="pl-s">'bar'</span>
  <span class="pl-kos">}</span><span class="pl-kos">;</span>

  <span class="pl-s1">factory</span><span class="pl-kos">.</span><span class="pl-en">sayHello</span> <span class="pl-c1">=</span> <span class="pl-k">function</span> <span class="pl-en">sayHello</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-en">alert</span><span class="pl-kos">(</span><span class="pl-s">'Hello '</span> <span class="pl-c1">+</span> <span class="pl-s1">name</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-kos">}</span><span class="pl-kos">;</span>

  <span class="pl-k">return</span> <span class="pl-s1">factory</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto"><strong>What is the expected behavior?</strong><br>
Should always import the default export.</p>
<p dir="auto"><strong>Please mention other relevant information such as the browser version, Node.js version, Operating System and programming language.</strong><br>
Webpack: 2.1.0-beta.27<br>
Node: v7</p>
<p dir="auto"><strong>I'm submitting a bug report</strong></p>
<p dir="auto"><strong>Webpack version:</strong><br>
2.1.0-beta.25</p>
<p dir="auto"><strong>Please tell us about your environment:</strong><br>
OSX 10.12 (16A323)</p>
<p dir="auto"><strong>Current behavior:</strong><br>
When I use webpack with babel and the the <code class="notranslate">babel-plugin-transform-es2015-modules-commonjs</code> transform I can't import a ES6 module anymore which is not transpiled by babel.</p>
<p dir="auto">Babel handles the module like an CommonJS module because webpack doesn't set the <code class="notranslate">__esModules</code> flag to <code class="notranslate">true</code>.</p>
<p dir="auto"><strong>Expected/desired behavior:</strong><br>
I should be able to import the module.</p>
<ul dir="auto">
<li><strong>If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem along with a gist/jsbin of your webpack configuration.</strong><br>
<a href="https://github.com/k15a/webpack2-babel-bug">https://github.com/k15a/webpack2-babel-bug</a></li>
<li><strong>What is the motivation / use case for changing the behavior?</strong><br>
<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="183665744" data-permission-text="Title is private" data-url="https://github.com/styled-components/styled-components/issues/115" data-hovercard-type="issue" data-hovercard-url="/styled-components/styled-components/issues/115/hovercard" href="https://github.com/styled-components/styled-components/issues/115">styled-components/styled-components#115</a></li>
<li><strong>Language:</strong><br>
ES6/7</li>
</ul>