Issue 1:
Bug report

What is the current behavior?

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.

Hence we used the optimization block inside the config.

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',
},
}
},

But after using this to bundle our components lib, and using this library inside the next.js app we get the error

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.<anonymous> (/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)

which arises from here at 192 line.

If the current behavior is a bug, please provide the steps to reproduce.

Mentioned above

What is the expected behavior?

It should run without giving any errors

Other relevant information:

webpack version: 5.40

Node.js version: 14.0.0

Operating System: mac os

next.js version: 12.0.7

Issue 2:
Bug report

What is the current behavior?

Currently webpack 4.39.2 depends on loader-runner 2.4.0, which tests for and uses System.import, which is used by SystemJS.

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.

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.

It fails with

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

Notice that the path is "duplicated".

If the current behavior is a bug, please provide the steps to reproduce.

I've created what I think is a minimal setup to show the issue at https://github.com/brunomlopes/jspm-webpack-gulp-issue

It's a gulpfile and a minimal webpack configuration. The issue can be seen by running gulp which triggers the default task.

What is the expected behavior?

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.

We expect to be able to use SystemJS and Webpack site-by-side.

Other relevant information:

webpack version: "^4.39.2"

Node.js version: "10.16.3"

Operating System: Windows 10

Additional tools: "jspm": "0.16.53", "gulp": "^3.9.0",