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




<p dir="auto">I am trying to upgrade my project from 4.x to 5.22 beta and the application stops working with libraryTarget as 'system' , i am loading the module using System.JS dynamically and the exported methods are missing in the 5.X</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="try {
				// eslint-disable-next-line no-undef
				const fetchedModule = await window.System.import(modulePath);
				setModule(fetchedModule);
			} catch (moduleError) {
				console.log(moduleError);
				setError(true);
			}"><pre class="notranslate"><code class="notranslate">try {
				// eslint-disable-next-line no-undef
				const fetchedModule = await window.System.import(modulePath);
				setModule(fetchedModule);
			} catch (moduleError) {
				console.log(moduleError);
				setError(true);
			}
</code></pre></div>
<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/ajaybeniwal/WebpackFailError">https://github.com/ajaybeniwal/WebpackFailError</a></p>





<p dir="auto"><strong>What is the expected behavior?</strong><br>
The application should work without any issues after the upgrade</p>


<p dir="auto"><strong>Other relevant information:</strong><br>
webpack version:  "webpack": "5.0.0-beta.22",<br>
Node.js version:<br>
Operating System: Mac<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/658004/87062514-b5f9da00-c23f-11ea-8f97-f0024168c937.png"><img width="933" alt="Screenshot 2020-07-09 at 11 30 03 PM" src="https://user-images.githubusercontent.com/658004/87062514-b5f9da00-c23f-11ea-8f97-f0024168c937.png" style="max-width: 100%;"></a><br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/658004/87062522-b7c39d80-c23f-11ea-91d7-06485bdfc6f5.png"><img width="970" alt="Screenshot 2020-07-09 at 11 29 46 PM" src="https://user-images.githubusercontent.com/658004/87062522-b7c39d80-c23f-11ea-91d7-06485bdfc6f5.png" style="max-width: 100%;"></a></p>
<p dir="auto">Additional tools:</p>
<h1 dir="auto">Bug report</h1>




<p dir="auto">DISCLAIMER: this issue is a duplicate of <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="409909056" data-permission-text="Title is private" data-url="https://github.com/webpack/webpack/issues/8782" data-hovercard-type="issue" data-hovercard-url="/webpack/webpack/issues/8782/hovercard" href="https://github.com/webpack/webpack/issues/8782">#8782</a>. The original issue was closed without (as I can see) any strong reason. I asked to reopen the original issue, but, unfortunately, did not hear back. This bug is stopping us from migrating to webpack 4 from 3 (it works correctly in webpack 3). It will be great if someone can take a look.</p>
<p dir="auto"><strong>What is the current behavior?</strong><br>
I'm importing css files from a third party library (installed in node_modules) into my main entry point. When I run webpack in <code class="notranslate">development</code> mode, the css files are correctly processed and extracted into the separate css file.<br>
However, in <code class="notranslate">production</code> mode the css files are not processed at all.</p>
<p dir="auto">Webpack output in <code class="notranslate">development</code> mode:<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/3608139/53029831-ad7ce580-3437-11e9-9a06-e22e0274dc82.png"><img width="619" alt="screen shot 2019-02-19 at 11 12 25 am" src="https://user-images.githubusercontent.com/3608139/53029831-ad7ce580-3437-11e9-9a06-e22e0274dc82.png" style="max-width: 100%;"></a><br>
As you can see it has <code class="notranslate">styles.css</code> and <code class="notranslate">styles.index.js</code></p>
<p dir="auto">Webpack output in <code class="notranslate">production</code> mode:<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/3608139/53029894-cbe2e100-3437-11e9-9f9d-34e81c3f2f94.png"><img width="617" alt="screen shot 2019-02-19 at 11 13 16 am" src="https://user-images.githubusercontent.com/3608139/53029894-cbe2e100-3437-11e9-9f9d-34e81c3f2f94.png" style="max-width: 100%;"></a><br>
As you can see it <strong>does not have</strong> <code class="notranslate">styles.css</code> and <code class="notranslate">styles.index.js</code></p>
<p dir="auto"><strong>If the current behavior is a bug, please provide the steps to reproduce.</strong><br>
Please take a look at <a href="https://github.com/maksimsemenov/webpack-css-issue">GitHub repository</a></p>
<p dir="auto">The repo has two absolutely identical configs except for <code class="notranslate">mode</code> property. I'm aware that it is not recommended to use split chunks in <code class="notranslate">development</code> mode. The purpose to have dev and prod configs identical is to illustrate that only difference in <code class="notranslate">mode</code> affects which files has been processed by webpack and which not.</p>
<p dir="auto">Run:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="yarn install

yarn build
yarn build:dev"><pre class="notranslate"><code class="notranslate">yarn install

yarn build
yarn build:dev
</code></pre></div>
<p dir="auto">Check the output of those commands. The webpack that run in <code class="notranslate">development</code> has a css files in the output, while the one that was in <code class="notranslate">production</code> does not.</p>






<p dir="auto"><strong>What is the expected behavior?</strong><br>
Webpack should process css files from node_modules that are imported into entry point in <code class="notranslate">development</code> and <code class="notranslate">production</code> modes.</p>


<p dir="auto"><strong>Other relevant information:</strong><br>
webpack version: 4.28.4<br>
Node.js version: 11.6.0<br>
Operating System: macOS Mojave<br>
Additional tools: yarn 1.13.0</p>