<h1 dir="auto">Bug report</h1>




<p dir="auto"><strong>What is the current behavior?</strong></p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&lt;w&gt; [webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: Can't resolve 'url' in '/Users/keenwon/Test/webpack-test'
&lt;w&gt; while resolving 'url' in /Users/keenwon/Test/webpack-test as file
&lt;w&gt;  at resolve esm file url
&lt;w&gt;  at file dependencies /Users/keenwon/Test/webpack-test/webpack.config.mjs
&lt;w&gt;  at file /Users/keenwon/Test/webpack-test/webpack.config.mjs
&lt;w&gt;  at resolve commonjs /Users/keenwon/Test/webpack-test/webpack.config.mjs"><pre class="notranslate"><span class="pl-k">&lt;</span>w<span class="pl-k">&gt;</span> [webpack.cache.PackFileCacheStrategy] Caching failed <span class="pl-k">for</span> <span class="pl-smi">pack: Error: Can<span class="pl-s"><span class="pl-pds">'</span>t resolve <span class="pl-pds">'</span></span>url<span class="pl-s"><span class="pl-pds">'</span></span></span> <span class="pl-k">in</span> <span class="pl-s"><span class="pl-pds">'</span>/Users/keenwon/Test/webpack-test<span class="pl-pds">'</span></span>
<span class="pl-k">&lt;</span>w<span class="pl-k">&gt;</span> <span class="pl-k">while</span> resolving <span class="pl-s"><span class="pl-pds">'</span>url<span class="pl-pds">'</span></span> <span class="pl-k">in</span> /Users/keenwon/Test/webpack-test as file
<span class="pl-k">&lt;</span>w<span class="pl-k">&gt;</span>  at resolve esm file url
<span class="pl-k">&lt;</span>w<span class="pl-k">&gt;</span>  at file dependencies /Users/keenwon/Test/webpack-test/webpack.config.mjs
<span class="pl-k">&lt;</span>w<span class="pl-k">&gt;</span>  at file /Users/keenwon/Test/webpack-test/webpack.config.mjs
<span class="pl-k">&lt;</span>w<span class="pl-k">&gt;</span>  at resolve commonjs /Users/keenwon/Test/webpack-test/webpack.config.mjs</pre></div>
<p dir="auto"><strong>If the current behavior is a bug, please provide the steps to reproduce.</strong></p>
<p dir="auto">works fine, no warnings</p>






<p dir="auto"><strong>What is the expected behavior?</strong></p>


<p dir="auto"><strong>Other relevant information:</strong><br>
webpack version:  5.70.0<br>
Node.js version: v14.19.0<br>
Operating System: macOS 12.3<br>
Additional tools:</p>
<p dir="auto"><strong>demo</strong></p>
<p dir="auto">repo <a href="https://github.com/keenwon/webpack-test">https://github.com/keenwon/webpack-test</a>, <strong>switch to node-prefix branch</strong></p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/5516478/159485407-88a3be9c-f9be-4589-8774-d8cdfdecdbc4.png"><img src="https://user-images.githubusercontent.com/5516478/159485407-88a3be9c-f9be-4589-8774-d8cdfdecdbc4.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto"><code class="notranslate">node:</code> doesn't work either</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/5516478/159485500-a1be2179-4cff-427b-a2b7-2026d0b124f5.png"><img src="https://user-images.githubusercontent.com/5516478/159485500-a1be2179-4cff-427b-a2b7-2026d0b124f5.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto">Hey,</p>
<p dir="auto">I'm trying to pack <a href="https://github.com/ded/klass">https://github.com/ded/klass</a> and webpack isn't impressed with it:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt; webpack node_modules/klass/klass.js klass.packed.js

Hash: 214a480310b53c1a2c79305e8fbc6cf7
Compile Time: 124ms
Chunks: 1
Modules: 1
Modules including duplicates: 1
Modules first chunk: 1
main   klass.packed.js:      893 chars/bytes

 &lt;id&gt;    &lt;size&gt;  &lt;filename&gt;
klass.packed.js
    0            ./~/klass/klass.js
ERROR: Entry module failed!
 Error: File &quot;/Users/rainerdreyer/Workspace/PipeDream/node_modules/klass/klass.js&quot; parsing failed: TypeError: Cannot call method 'push' of undefined
 @ ./klass.js"><pre class="notranslate"><code class="notranslate">&gt; webpack node_modules/klass/klass.js klass.packed.js

Hash: 214a480310b53c1a2c79305e8fbc6cf7
Compile Time: 124ms
Chunks: 1
Modules: 1
Modules including duplicates: 1
Modules first chunk: 1
main   klass.packed.js:      893 chars/bytes

 &lt;id&gt;    &lt;size&gt;  &lt;filename&gt;
klass.packed.js
    0            ./~/klass/klass.js
ERROR: Entry module failed!
 Error: File "/Users/rainerdreyer/Workspace/PipeDream/node_modules/klass/klass.js" parsing failed: TypeError: Cannot call method 'push' of undefined
 @ ./klass.js
</code></pre></div>
<p dir="auto">But there is no call to <code class="notranslate">push</code> in the klass source code as far as I can see. Could you check why webpack can't handle this? Unfortunately most of my code uses inheritance with klass, so the packaging of everything fails.</p>
<p dir="auto">Thanks!</p>