<h1 dir="auto">Bug report</h1>
<p dir="auto"><strong>What is the current behavior?</strong></p>
<p dir="auto"><code class="notranslate">webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Resolving '.pnpm/es5-ext@0.10.53/node_modules/es5-ext/array/#/clear' in /Users/scamden/creditiq/uno/common/temp/node_modules/.pnpm/es6-iterator@2.0.3/node_modules/es6-iterator for build dependencies doesn't lead to expected result '/Users/scamden/creditiq/uno/common/temp/node_modules/.pnpm/es5-ext@0.10.53/node_modules/es5-ext/array/#/clear.js', but to '/Users/scamden/creditiq/uno/common/temp/node_modules/.pnpm/es5-ext@0.10.53/node_modules/es5-ext/array/#/clear.js' instead. Resolving dependencies are ignored for this path.</code></p>
<p dir="auto">warning on writing persistent cache in development mode if the dep has a # in the path and has already been loaded by node prior to dependency resolution for the cache.</p>
<p dir="auto"><strong>If the current behavior is a bug, please provide the steps to reproduce.</strong></p>
<p dir="auto"><a href="https://github.com/creditiq/simple-repros/tree/webpack-cache-resolution-warning">https://github.com/creditiq/simple-repros/tree/webpack-cache-resolution-warning</a></p>
<p dir="auto">Repro:</p>
<ol dir="auto">
<li>Clone the above</li>
<li><code class="notranslate">npm i</code></li>
<li><code class="notranslate">cd nested</code></li>
<li><code class="notranslate">npm run build</code></li>
</ol>
<p dir="auto">(note: this branch also contains a repro for bug: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="759818945" data-permission-text="Title is private" data-url="https://github.com/webpack/webpack/issues/12156" data-hovercard-type="issue" data-hovercard-url="/webpack/webpack/issues/12156/hovercard" href="https://github.com/webpack/webpack/issues/12156">#12156</a>, if you do the same steps but replace step 3 with <code class="notranslate">cd \#nested</code>)</p>
<p dir="auto">Result:<br>
warning above</p>
<p dir="auto">Expected:<br>
no warning</p>
<p dir="auto">I have tracked the bug down to a \u0000 in the resolved result (that was added by webpack code when escaping the # one stack frame above the warning) that is not there in the <code class="notranslate">job.expected</code> value.</p>
<p dir="auto">The expected value in my case was resolved via the require.cache inside the RBDT_FILE_DEPENDENCIES job as a RBDT_RESOLVE_CJS_FILE_AS_CHILD. I checked every path and child path one level deep in that cache and not one value had a \u0000 in it so I'm guessing the fix is to escape # with \0 when the file was found in the require.cache, but the code is a bit over my head so hopefully this lead gives someone more familiar a light bulb. Maybe alternatively the expected and result values should be compared with any \0 stripped out. Hopefully a maintainer will know <g-emoji class="g-emoji" alias="grimacing" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f62c.png">😬</g-emoji> I've made a PR <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="858509204" data-permission-text="Title is private" data-url="https://github.com/webpack/webpack/issues/13149" data-hovercard-type="pull_request" data-hovercard-url="/webpack/webpack/pull/13149/hovercard" href="https://github.com/webpack/webpack/pull/13149">#13149</a> for the latter because it feels lower risk, but if the right solution is to add escaping to paths found in the require.cache, I'm happy to do that instead :)</p>
<p dir="auto">webpack version:  5.31.0<br>
Node.js version: 14.16.0<br>
Operating System: Mac OS X Catalina<br>
Additional tools:</p>
<p dir="auto"><code class="notranslate">webpack --json --profile</code> reports a chunk more than once for a single entrypoint under <code class="notranslate">"entrypoints"</code>.</p>
<div class="highlight highlight-source-json notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&quot;entrypoints&quot;: {
    &quot;site&quot;: {
      &quot;chunks&quot;: [
        5,
        1,
        0,
        null,
        5,
        4
      ],
      ...
    }
}"><pre class="notranslate"><span class="pl-ent">"entrypoints"</span>: {
    <span class="pl-ent">"site"</span>: {
      <span class="pl-ent">"chunks"</span>: [
        <span class="pl-c1">5</span>,
        <span class="pl-c1">1</span>,
        <span class="pl-c1">0</span>,
        <span class="pl-c1">null</span>,
        <span class="pl-c1">5</span>,
        <span class="pl-c1">4</span>
      ],
      <span class="pl-ii">...</span>
    }
}</pre></div>
<p dir="auto">My first impression was that these chunks are ordered and not repeating. What guarantees does an entrypoint have in this context?</p>