<h2 dir="auto">Bug Report</h2>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I would like to work on a fix!</li>
</ul>
<p dir="auto"><strong>Current behavior</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="TypeError: Cannot redefine property: c"><pre class="notranslate"><code class="notranslate">TypeError: Cannot redefine property: c
</code></pre></div>
<p dir="auto">Namespace reexports are transpiled like this:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="for(key ...){
  Object.defineProperty(exports, key, {
    enumerable: true,
    get: function () {
      return imported[key];
    }
  });
}"><pre class="notranslate"><span class="pl-k">for</span><span class="pl-kos">(</span><span class="pl-s1">key</span> <span class="pl-kos">.</span><span class="pl-kos">.</span><span class="pl-kos">.</span><span class="pl-kos">)</span><span class="pl-kos">{</span>
  <span class="pl-c1">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-s1">key</span><span class="pl-kos">,</span> <span class="pl-kos">{</span>
    <span class="pl-c1">enumerable</span>: <span class="pl-c1">true</span><span class="pl-kos">,</span>
    <span class="pl-en">get</span>: <span class="pl-k">function</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">imported</span><span class="pl-kos">[</span><span class="pl-s1">key</span><span class="pl-kos">]</span><span class="pl-kos">;</span>
    <span class="pl-kos">}</span>
  <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">But the spec allows for reexporting a symbol twice in the same file if it is actually the same binding (see example code below).</p>
<p dir="auto">This means that <code class="notranslate">Object.defineProperty(exports, "c", ...)</code> is called twice, causing the error.</p>
<p dir="auto">One of the packages that do this is <code class="notranslate">@fluentui/react</code> (this came up in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="589784968" data-permission-text="Title is private" data-url="https://github.com/parcel-bundler/parcel/issues/4399" data-hovercard-type="issue" data-hovercard-url="/parcel-bundler/parcel/issues/4399/hovercard" href="https://github.com/parcel-bundler/parcel/issues/4399">parcel-bundler/parcel#4399</a>)</p>
<p dir="auto"><strong>Input Code</strong></p>
<ul dir="auto">
<li><a href="https://github.com/mischnic/parcel-issue-4399">https://github.com/mischnic/parcel-issue-4399</a> (<code class="notranslate">lib/</code> already contains the Babel output of <code class="notranslate">src-valid</code>)</li>
</ul>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="export * from &quot;./a.js&quot;;
export * from &quot;./b.js&quot;;

// ---- everything below is just for context ---

// a.js
export { c } from './c.js'; // &lt;-- 
export const a = &quot;a&quot;;
// b.js
export { c } from './c.js'; // &lt;-- 
export const b = &quot;b&quot;;

// c.js
export function c() {
	return false;
}"><pre class="notranslate"><span class="pl-k">export</span> <span class="pl-c1">*</span> <span class="pl-k">from</span> <span class="pl-s">"./a.js"</span><span class="pl-kos">;</span>
<span class="pl-k">export</span> <span class="pl-c1">*</span> <span class="pl-k">from</span> <span class="pl-s">"./b.js"</span><span class="pl-kos">;</span>

<span class="pl-c">// ---- everything below is just for context ---</span>

<span class="pl-c">// a.js</span>
<span class="pl-k">export</span> <span class="pl-kos">{</span> <span class="pl-s1">c</span> <span class="pl-kos">}</span> <span class="pl-k">from</span> <span class="pl-s">'./c.js'</span><span class="pl-kos">;</span> <span class="pl-c">// &lt;-- </span>
<span class="pl-k">export</span> <span class="pl-k">const</span> <span class="pl-s1">a</span> <span class="pl-c1">=</span> <span class="pl-s">"a"</span><span class="pl-kos">;</span>
<span class="pl-c">// b.js</span>
<span class="pl-k">export</span> <span class="pl-kos">{</span> <span class="pl-s1">c</span> <span class="pl-kos">}</span> <span class="pl-k">from</span> <span class="pl-s">'./c.js'</span><span class="pl-kos">;</span> <span class="pl-c">// &lt;-- </span>
<span class="pl-k">export</span> <span class="pl-k">const</span> <span class="pl-s1">b</span> <span class="pl-c1">=</span> <span class="pl-s">"b"</span><span class="pl-kos">;</span>

<span class="pl-c">// c.js</span>
<span class="pl-k">export</span> <span class="pl-k">function</span> <span class="pl-en">c</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-c1">false</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto"><strong>Expected behavior</strong></p>
<p dir="auto">The first file should export <code class="notranslate">a, b, c</code> (and not throw).</p>
<p dir="auto"><strong>Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc)</strong></p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="babel --plugins @babel/plugin-transform-modules-commonjs --delete-dir-on-start src-valid -d lib"><pre class="notranslate">babel --plugins @babel/plugin-transform-modules-commonjs --delete-dir-on-start src-valid -d lib</pre></div>
<p dir="auto"><strong>Environment</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="  System:
    OS: macOS 10.15.4
  Binaries:
    Node: 14.4.0 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.4 - /usr/local/bin/npm
  npmPackages:
    @babel/cli: ^7.10.1 =&gt; 7.10.1
    @babel/core: ^7.10.2 =&gt; 7.10.2
    @babel/plugin-transform-modules-commonjs: ^7.10.1 =&gt; 7.10.1"><pre class="notranslate"><code class="notranslate">  System:
    OS: macOS 10.15.4
  Binaries:
    Node: 14.4.0 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.4 - /usr/local/bin/npm
  npmPackages:
    @babel/cli: ^7.10.1 =&gt; 7.10.1
    @babel/core: ^7.10.2 =&gt; 7.10.2
    @babel/plugin-transform-modules-commonjs: ^7.10.1 =&gt; 7.10.1
</code></pre></div>
<p dir="auto"><strong>Possible Solution</strong><br>
Not use <code class="notranslate">Object.defineProperty</code>? <code class="notranslate">configurable: true</code> ? But all of these have other sideffects</p>
<p dir="auto"><strong>Additional context</strong></p>
<p dir="auto">Technically, f there are conflicting reexports (see <code class="notranslate">src-invalid</code>), there should be a SyntaxError (!).</p>
<p dir="auto">But even <a href="https://rollupjs.org/repl/?version=2.15.0&amp;shareable=JTdCJTIybW9kdWxlcyUyMiUzQSU1QiU3QiUyMm5hbWUlMjIlM0ElMjJtYWluLmpzJTIyJTJDJTIyY29kZSUyMiUzQSUyMmV4cG9ydCUyMColMjBmcm9tJTIwJTVDJTIyLiUyRmEuanMlNUMlMjIlM0IlNUNuZXhwb3J0JTIwKiUyMGZyb20lMjAlNUMlMjIuJTJGYi5qcyU1QyUyMiUzQiUyMiUyQyUyMmlzRW50cnklMjIlM0F0cnVlJTdEJTJDJTdCJTIybmFtZSUyMiUzQSUyMmEuanMlMjIlMkMlMjJjb2RlJTIyJTNBJTIyZXhwb3J0JTIwJTdCJTIwYyUyMCU3RCUyMGZyb20lMjAnLiUyRmMxLmpzJyUzQiU1Q25leHBvcnQlMjBjb25zdCUyMGElMjAlM0QlMjAlNUMlMjJhJTVDJTIyJTNCJTIyJTJDJTIyaXNFbnRyeSUyMiUzQWZhbHNlJTdEJTJDJTdCJTIybmFtZSUyMiUzQSUyMmIuanMlMjIlMkMlMjJjb2RlJTIyJTNBJTIyZXhwb3J0JTIwJTdCJTIwYyUyMCU3RCUyMGZyb20lMjAnLiUyRmMyLmpzJyUzQiU1Q25leHBvcnQlMjBjb25zdCUyMGIlMjAlM0QlMjAlNUMlMjJiJTVDJTIyJTNCJTIyJTJDJTIyaXNFbnRyeSUyMiUzQWZhbHNlJTdEJTJDJTdCJTIybmFtZSUyMiUzQSUyMmMxLmpzJTIyJTJDJTIyY29kZSUyMiUzQSUyMmV4cG9ydCUyMGZ1bmN0aW9uJTIwYygpJTIwJTdCJTVDbiU1Q3RyZXR1cm4lMjBmYWxzZSUzQiU1Q24lN0QlMjIlN0QlMkMlN0IlMjJuYW1lJTIyJTNBJTIyYzIuanMlMjIlMkMlMjJjb2RlJTIyJTNBJTIyZXhwb3J0JTIwZnVuY3Rpb24lMjBjKCklMjAlN0IlNUNuJTVDdHJldHVybiUyMHRydWUlM0IlNUNuJTdEJTIyJTdEJTVEJTJDJTIyb3B0aW9ucyUyMiUzQSU3QiUyMmZvcm1hdCUyMiUzQSUyMmVzJTIyJTJDJTIybmFtZSUyMiUzQSUyMm15QnVuZGxlJTIyJTJDJTIyYW1kJTIyJTNBJTdCJTIyaWQlMjIlM0ElMjIlMjIlN0QlMkMlMjJnbG9iYWxzJTIyJTNBJTdCJTdEJTdEJTJDJTIyZXhhbXBsZSUyMiUzQW51bGwlN0Q=" rel="nofollow">Rollup doesn't handle this correctly</a> (and Babel cannot work across multiple files anyway). <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="637362926" data-permission-text="Title is private" data-url="https://github.com/rollup/rollup/issues/3629" data-hovercard-type="issue" data-hovercard-url="/rollup/rollup/issues/3629/hovercard" href="https://github.com/rollup/rollup/issues/3629">rollup/rollup#3629</a></p>
<p dir="auto">having the same problem here but in Safari<br>
<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="78129280" data-permission-text="Title is private" data-url="https://github.com/babel/babel/issues/1574" data-hovercard-type="issue" data-hovercard-url="/babel/babel/issues/1574/hovercard" href="https://github.com/babel/babel/issues/1574">#1574</a></p>