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




<p dir="auto"><strong>What is the current behavior?</strong><br>
We have a components library where we have multiple entry points setup for components. Since we had nesting of components as well, we were ending up duplicating the code.</p>
<p dir="auto">Hence we used the optimization block inside the config.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="optimization: {
    splitChunks: {
      chunks: 'all',
      minChunks: 1,
      minSize: 1000,
      maxInitialRequests: Infinity,
      cacheGroups: {
        vendorCss: {
          test: /[\\/]node_modules[\\/](@hotstar\/isomorphic-style-loader|css-loader)[\\/]/,
          name: 'vendor_css_loaders',
          chunks: 'all',
        },
      }
    },"><pre class="notranslate"><code class="notranslate">optimization: {
    splitChunks: {
      chunks: 'all',
      minChunks: 1,
      minSize: 1000,
      maxInitialRequests: Infinity,
      cacheGroups: {
        vendorCss: {
          test: /[\\/]node_modules[\\/](@hotstar\/isomorphic-style-loader|css-loader)[\\/]/,
          name: 'vendor_css_loaders',
          chunks: 'all',
        },
      }
    },
</code></pre></div>
<p dir="auto">But after using this to bundle our components lib, and using this library inside the next.js app we get the error</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="TypeError: Cannot read property '__esModule' of undefined
    at /Users/ajayjaggi/Desktop/Hotstar/web-website/node_modules/@hotstar/web-ui-components-lib/modern/components/Molecule/CustomError/src/index.js:328:34
    at Object.&lt;anonymous&gt; (/Users/ajayjaggi/Desktop/Hotstar/web-website/node_modules/@hotstar/web-ui-components-lib/modern/components/Molecule/CustomError/src/index.js:330:12)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:93:18)
    at Object.@hotstar/web-ui-components-lib/modern/components/Molecule/CustomError/src (/Users/ajayjaggi/Desktop/Hotstar/web-website/packages/website/.next/server/pages/_app.js:1273:18)
    at __webpack_require__ (/Users/ajayjaggi/Desktop/Hotstar/web-website/packages/website/.next/server/webpack-runtime.js:33:42)
"><pre class="notranslate"><code class="notranslate">TypeError: Cannot read property '__esModule' of undefined
    at /Users/ajayjaggi/Desktop/Hotstar/web-website/node_modules/@hotstar/web-ui-components-lib/modern/components/Molecule/CustomError/src/index.js:328:34
    at Object.&lt;anonymous&gt; (/Users/ajayjaggi/Desktop/Hotstar/web-website/node_modules/@hotstar/web-ui-components-lib/modern/components/Molecule/CustomError/src/index.js:330:12)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:93:18)
    at Object.@hotstar/web-ui-components-lib/modern/components/Molecule/CustomError/src (/Users/ajayjaggi/Desktop/Hotstar/web-website/packages/website/.next/server/pages/_app.js:1273:18)
    at __webpack_require__ (/Users/ajayjaggi/Desktop/Hotstar/web-website/packages/website/.next/server/webpack-runtime.js:33:42)

</code></pre></div>
<p dir="auto">which arises from here at 192 line.<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/85304785/182784693-1eb46b9f-6478-47e2-aeaa-b3ec4682eff6.png"><img src="https://user-images.githubusercontent.com/85304785/182784693-1eb46b9f-6478-47e2-aeaa-b3ec4682eff6.png" alt="Screenshot 2022-08-04 at 12 34 19 PM" style="max-width: 100%;"></a></p>
<p dir="auto"><strong>If the current behavior is a bug, please provide the steps to reproduce.</strong><br>
Mentioned above</p>






<p dir="auto"><strong>What is the expected behavior?</strong><br>
It should run without giving any errors</p>


<p dir="auto"><strong>Other relevant information:</strong><br>
webpack version:  5.40<br>
Node.js version:  14.0.0<br>
Operating System: mac os<br>
next.js version: 12.0.7</p>
<h1 dir="auto">Bug report</h1>




<p dir="auto"><strong>What is the current behavior?</strong></p>
<p dir="auto">Currently webpack 4.39.2 depends on loader-runner 2.4.0, which tests for and uses System.import, which is used by SystemJS.<br>
Since loader-runner@2.4.0 tries to use System.import, any import fails since it tries to run through SystemJS instead of node's module-resolution.<br>
loader-runner@3.0.0 no longer uses System.import, which might mean that a bump of "loader-runner" to 3.0.0 should fix this issue.</p>
<p dir="auto">It fails with</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Module build failed (from ./node_modules/babel-loader/lib/index.js):
(SystemJS) ENOENT: no such file or directory, open 'D:\documents\dev\jspm-webpack\D:\documents\dev\jspm-webpack\node_modules\babel-loader\lib\index.js'
        Error: ENOENT: no such file or directory, open 'D:\documents\dev\jspm-webpack\D:\documents\dev\jspm-webpack\node_modules\babel-loader\lib\index.js'
        Error loading D:/documents/dev/jspm-webpack/D:\documents\dev\jspm-webpack\node_modules\babel-loader\lib\index.js"><pre class="notranslate"><code class="notranslate">Module build failed (from ./node_modules/babel-loader/lib/index.js):
(SystemJS) ENOENT: no such file or directory, open 'D:\documents\dev\jspm-webpack\D:\documents\dev\jspm-webpack\node_modules\babel-loader\lib\index.js'
        Error: ENOENT: no such file or directory, open 'D:\documents\dev\jspm-webpack\D:\documents\dev\jspm-webpack\node_modules\babel-loader\lib\index.js'
        Error loading D:/documents/dev/jspm-webpack/D:\documents\dev\jspm-webpack\node_modules\babel-loader\lib\index.js
</code></pre></div>
<p dir="auto">Notice that the path is "duplicated".</p>
<p dir="auto"><strong>If the current behavior is a bug, please provide the steps to reproduce.</strong></p>
<p dir="auto">I've created what I think is a minimal setup to show the issue at <a href="https://github.com/brunomlopes/jspm-webpack-gulp-issue">https://github.com/brunomlopes/jspm-webpack-gulp-issue</a></p>
<p dir="auto">It's a gulpfile and a minimal webpack configuration. The issue can be seen by running <code class="notranslate">gulp</code> which triggers the default task.</p>






<p dir="auto"><strong>What is the expected behavior?</strong></p>
<p dir="auto">We have a large SystemJS app we want to migrate to webpack, and want to do it in small steps, using the existing gulp infrastructure and scripts.<br>
We expect to be able to use SystemJS and Webpack site-by-side.</p>


<p dir="auto"><strong>Other relevant information:</strong><br>
webpack version: "^4.39.2"<br>
Node.js version: "10.16.3"<br>
Operating System: Windows 10<br>
Additional tools: "jspm": "0.16.53", "gulp": "^3.9.0",</p>