<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="//moduleA.js
export default {
  foo: 'bar'
}"><pre class="notranslate"><code class="notranslate">//moduleA.js
export default {
  foo: 'bar'
}
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="//moduleB.js
import { foo } from './moduleA';

const something = foo.baz;"><pre class="notranslate"><code class="notranslate">//moduleB.js
import { foo } from './moduleA';

const something = foo.baz;
</code></pre></div>
<p dir="auto">Unfortunately the compiled code does not reference <code class="notranslate">default</code> at all, so i end up looking at <code class="notranslate">moduleA.foo.baz</code> instead of <code class="notranslate">moduleA.default.foo.baz</code>. I have noticed that <code class="notranslate">interopRequireDefault</code> is not used in this case (not sure what triggers the use of this helper, but it seems like I would want it to apply here).</p>
<p dir="auto">Here is the query I pass to babel for refernece:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="            query: {
                'presets': [
                    'react'
                ],
                'plugins': [
                    'transform-proto-to-assign',
                    'syntax-object-rest-spread',
                    'transform-object-rest-spread',
                    'babel-plugin-transform-es2015-arrow-functions',
                    'babel-plugin-transform-es2015-block-scoped-functions',
                    'babel-plugin-transform-es2015-block-scoping',
                    'babel-plugin-transform-es2015-computed-properties',
                    'babel-plugin-transform-es2015-destructuring',
                    'babel-plugin-transform-es2015-for-of',
                    'babel-plugin-transform-es2015-function-name',
                    'babel-plugin-transform-es2015-literals',
                    'babel-plugin-transform-es2015-object-super',
                    'babel-plugin-transform-es2015-parameters',
                    'babel-plugin-transform-es2015-shorthand-properties',
                    'babel-plugin-transform-es2015-spread',
                    'babel-plugin-transform-es2015-sticky-regex',
                    'babel-plugin-transform-es2015-template-literals',
                    'babel-plugin-transform-es2015-typeof-symbol',
                    'babel-plugin-transform-es2015-unicode-regex',
                    [
                        'transform-es2015-modules-commonjs',
                        { loose: true }
                    ],
                    [
                        'transform-es2015-classes',
                        { loose: true }
                    ]
                ]
            }"><pre class="notranslate"><code class="notranslate">            query: {
                'presets': [
                    'react'
                ],
                'plugins': [
                    'transform-proto-to-assign',
                    'syntax-object-rest-spread',
                    'transform-object-rest-spread',
                    'babel-plugin-transform-es2015-arrow-functions',
                    'babel-plugin-transform-es2015-block-scoped-functions',
                    'babel-plugin-transform-es2015-block-scoping',
                    'babel-plugin-transform-es2015-computed-properties',
                    'babel-plugin-transform-es2015-destructuring',
                    'babel-plugin-transform-es2015-for-of',
                    'babel-plugin-transform-es2015-function-name',
                    'babel-plugin-transform-es2015-literals',
                    'babel-plugin-transform-es2015-object-super',
                    'babel-plugin-transform-es2015-parameters',
                    'babel-plugin-transform-es2015-shorthand-properties',
                    'babel-plugin-transform-es2015-spread',
                    'babel-plugin-transform-es2015-sticky-regex',
                    'babel-plugin-transform-es2015-template-literals',
                    'babel-plugin-transform-es2015-typeof-symbol',
                    'babel-plugin-transform-es2015-unicode-regex',
                    [
                        'transform-es2015-modules-commonjs',
                        { loose: true }
                    ],
                    [
                        'transform-es2015-classes',
                        { loose: true }
                    ]
                ]
            }
</code></pre></div>
<p dir="auto">Using babel 6.1.2, the following js:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="export default {}"><pre class="notranslate"><span class="pl-k">export</span> <span class="pl-k">default</span> <span class="pl-kos">{</span><span class="pl-kos">}</span></pre></div>
<p dir="auto">is transpiled to:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&quot;use strict&quot;;

Object.defineProperty(exports, &quot;__esModule&quot;, {
  value: true
});
exports.default = {};"><pre class="notranslate"><span class="pl-s">"use strict"</span><span class="pl-kos">;</span>

<span class="pl-v">Object</span><span class="pl-kos">.</span><span class="pl-en">defineProperty</span><span class="pl-kos">(</span><span class="pl-s1">exports</span><span class="pl-kos">,</span> <span class="pl-s">"__esModule"</span><span class="pl-kos">,</span> <span class="pl-kos">{</span>
  <span class="pl-c1">value</span>: <span class="pl-c1">true</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-s1">exports</span><span class="pl-kos">.</span><span class="pl-c1">default</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span><span class="pl-kos">}</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">using the following command line</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="babel --presets es2015 --plugins transform-es2015-modules-commonjs test.js"><pre class="notranslate">babel --presets es2015 --plugins transform-es2015-modules-commonjs test.js</pre></div>
<p dir="auto">However the output with the 5.x was:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&quot;use strict&quot;;

Object.defineProperty(exports, &quot;__esModule&quot;, {
  value: true
});
exports[&quot;default&quot;] = {};
module.exports = exports[&quot;default&quot;];"><pre class="notranslate"><span class="pl-s">"use strict"</span><span class="pl-kos">;</span>

<span class="pl-v">Object</span><span class="pl-kos">.</span><span class="pl-en">defineProperty</span><span class="pl-kos">(</span><span class="pl-s1">exports</span><span class="pl-kos">,</span> <span class="pl-s">"__esModule"</span><span class="pl-kos">,</span> <span class="pl-kos">{</span>
  <span class="pl-c1">value</span>: <span class="pl-c1">true</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-s1">exports</span><span class="pl-kos">[</span><span class="pl-s">"default"</span><span class="pl-kos">]</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span><span class="pl-kos">}</span><span class="pl-kos">;</span>
<span class="pl-smi">module</span><span class="pl-kos">.</span><span class="pl-c1">exports</span> <span class="pl-c1">=</span> <span class="pl-s1">exports</span><span class="pl-kos">[</span><span class="pl-s">"default"</span><span class="pl-kos">]</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">looks like <code class="notranslate">module.exports = exports["default"];</code> is missing although the <code class="notranslate">transform-es2015-modules-commonjs</code> is enabled.</p>
<p dir="auto">Is it a bug or I'm missing something ?<br>
Thank you !</p>