<p dir="auto">Version 1.8.9 succeeds but when updating to 1.8.10 I get an error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ERROR in CommonsChunkPlugin: While running in normal mode it's not allowed to use a non-entry chunk"><pre class="notranslate"><code class="notranslate">ERROR in CommonsChunkPlugin: While running in normal mode it's not allowed to use a non-entry chunk
</code></pre></div>
<p dir="auto">The bundle js is not output.</p>
<p dir="auto">My build output from deploying to Heroku (this error is on line 514):<br>
<a href="https://gist.github.com/bdefore/838bbe5be65dcb114014">https://gist.github.com/bdefore/838bbe5be65dcb114014</a></p>
<h1 dir="auto">Bug report</h1>




<p dir="auto"><strong>What is the current behavior?</strong></p>
<p dir="auto">Webpack randomly fails to bunle which causes <code class="notranslate">Uncaught SyntaxError: Unexpected token '}'</code> error message and broken code:</p>
<p dir="auto">It seems like it adds the following segment twice, which causes the problem:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="/******/ })()
;"><pre class="notranslate"><code class="notranslate">/******/ })()
;
</code></pre></div>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/7108843/165164825-293261bc-bbd6-4065-a3fc-cc0d1a8e347f.png"><img src="https://user-images.githubusercontent.com/7108843/165164825-293261bc-bbd6-4065-a3fc-cc0d1a8e347f.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto"><strong>If the current behavior is a bug, please provide the steps to reproduce.</strong></p>
<p dir="auto">The issue occurs randomly, the same codebase might fail without any code change.<br>
<code class="notranslate">cross-env NODE_ENV=production webpack --config ./webpack.config.js</code> is being used here.</p>






<p dir="auto"><strong>What is the expected behavior?</strong></p>
<p dir="auto">The build shouldn't fail randomly, the last 2 duplicate lines shouldn't be added at the end of the file.</p>


<p dir="auto"><strong>Other relevant information:</strong><br>
webpack version:  5.72.0 (this started happening after we've upgraded Webpack from v4 to v5)<br>
Node.js version: 14.0<br>
Operating System: Ubuntu 20.04<br>
Additional tools: gulp, tailwind v1.2, react v16.8</p>