<p dir="auto">I've seen this with <strong>coffee-loader</strong> and <strong>cjsx-loader</strong>, but <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="95010313" data-permission-text="Title is private" data-url="https://github.com/webpack/webpack/issues/1249" data-hovercard-type="issue" data-hovercard-url="/webpack/webpack/issues/1249/hovercard" href="https://github.com/webpack/webpack/issues/1249">#1249</a>  also reports this problem with <strong>jsx-loader</strong>. The problem seems to appear when we require the same file from outside a module and from within the module:</p>
<p dir="auto"><code class="notranslate">a.coffee</code> (within module <code class="notranslate">bb</code>):</p>
<div class="highlight highlight-source-coffee notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="module.exports = {just: 'an object'}"><pre class="notranslate"><span class="pl-c1">module</span>.<span class="pl-smi">exports</span> <span class="pl-k">=</span> {<span class="pl-v">just</span><span class="pl-k">:</span> <span class="pl-s"><span class="pl-pds">'</span>an object<span class="pl-pds">'</span></span>}</pre></div>
<p dir="auto"><code class="notranslate">b.coffee</code> (within module <code class="notranslate">bb</code>):</p>
<div class="highlight highlight-source-coffee notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="module.exports = require './a'"><pre class="notranslate"><span class="pl-c1">module</span>.<span class="pl-smi">exports</span> <span class="pl-k">=</span> <span class="pl-c1">require</span> <span class="pl-s"><span class="pl-pds">'</span>./a<span class="pl-pds">'</span></span></pre></div>
<p dir="auto"><code class="notranslate">odd.coffee</code>:</p>
<div class="highlight highlight-source-coffee notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="a = require('bb/a');
b = require('bb/b');
console.log a is b  # should be true"><pre class="notranslate"><span class="pl-v">a</span> <span class="pl-k">=</span> <span class="pl-c1">require</span>(<span class="pl-s"><span class="pl-pds">'</span>bb/a<span class="pl-pds">'</span></span>);
<span class="pl-v">b</span> <span class="pl-k">=</span> <span class="pl-c1">require</span>(<span class="pl-s"><span class="pl-pds">'</span>bb/b<span class="pl-pds">'</span></span>);
<span class="pl-en">console</span>.<span class="pl-en">log</span> a <span class="pl-k">is</span> b  <span class="pl-c"><span class="pl-c">#</span> should be true</span></pre></div>
<p dir="auto">When you run <code class="notranslate">coffee odd.coffee</code>, sure enough, you get: <code class="notranslate">true</code>.<br>
But when you run it through Webpack (with coffee-loader):</p>
<ul dir="auto">
<li>You get module <code class="notranslate">a</code> bundled twice:</li>
</ul>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="    [0] ./odd.coffee 94 bytes {0}
    [1] /Users/guillermo/Docs/Docs.Prog/JavaScript/bb/a.coffee 56 bytes {0} [built]
    [2] /Users/guillermo/Docs/Docs.Prog/JavaScript/bb/b.coffee 59 bytes {0}
    [3] /Users/guillermo/Docs/Docs.Prog/JavaScript/bb/a.coffee 56 bytes {0} [built]"><pre class="notranslate"><code class="notranslate">    [0] ./odd.coffee 94 bytes {0}
    [1] /Users/guillermo/Docs/Docs.Prog/JavaScript/bb/a.coffee 56 bytes {0} [built]
    [2] /Users/guillermo/Docs/Docs.Prog/JavaScript/bb/b.coffee 59 bytes {0}
    [3] /Users/guillermo/Docs/Docs.Prog/JavaScript/bb/a.coffee 56 bytes {0} [built]
</code></pre></div>
<ul dir="auto">
<li>What's worse, you get an unexpected result in the browser: <code class="notranslate">false</code></li>
</ul>
<h1 dir="auto">Bug report</h1>
<p dir="auto"><strong>What is the current behavior?</strong><br>
There may be duplicate resource urls in the sourcemaps. Which is neither defined as valid, nor as invalid.</p>
<p dir="auto"><strong>If the current behavior is a bug, please provide the steps to reproduce.</strong></p>
<p dir="auto">This is actually a query about an existing bug report:<br>
<a href="https://bugs.chromium.org/p/chromium/issues/detail?id=1329997" rel="nofollow">https://bugs.chromium.org/p/chromium/issues/detail?id=1329997</a></p>
<p dir="auto">It's a known bug now in Chrome 102, which has been bugging me for 3 weeks now.<br>
I was wondering if there's a simple way to deduplicate urls in the sourcemap, so we can workaround the Chrome bug.<br>
People may come here in search of a bugreport on webpack (I initially though it was a webpack issue and downgraded but it did not help).</p>
<p dir="auto"><strong>What is the expected behavior?</strong></p>
<p dir="auto">Should play nice with Chrome Devtools.<br>
The guys at Chromium say that they have been going back and forth between considering duplicate urls and deduplicating them. One side of it causes one kind of bug, the other side causes another kind of bug.<br>
So if there's an override from webpack, we could avoid this hassle altogether.</p>
<p dir="auto"><strong>Other relevant information:</strong><br>
webpack version:  5.73.0<br>
Node.js version:  16.3.2<br>
Operating System: WIndows 10<br>
Additional tools:</p>