Issue 1:
Feature request

Hello all,

I have an idea of new feature based on my personnal experience with webpack :

It seems that it is not possible to define usage of plugins, rules, optimization or something else on some specials entries.

What is the expected behavior?

The expected behavior (as I've first imagined this) could be to implement a property that allow us to restrict a functionality to one or X entries.

What is motivation or use case for adding/changing the behavior?

The motivation is that sometimes we need to have separate configuration for differents entries but for only one purpose, and want to keep the rest of the config.

Examples :

here we have 4 entries, imagine that I need to optimize all entries, but i don't want entry 'b' to be.

module.exports = {
entry: {
a: './src/a.js',
b: './src/b.js',
c: './src/c.js',
d: './src/d.js',
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: ['babel-loader'],
},
{
test: /\.(css|scss)$/,
loader: ['style-loader', 'css-loader', 'sass-loader'],
},
],
},
plugins: [new webpack.ProgressPlugin()],
optimization: {
splitChunks: {
chunks: 'all',
},
runtimeChunk: {
name: entrypoint => `runtime_${entrypoint.name}`,
},
},
};

Here, I can deal with array :

module.exports = [
{
entry: {
a: './src/a.js',
c: './src/c.js',
d: './src/d.js',
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: ['babel-loader'],
},
{
test: /\.(css|scss)$/,
loader: ['style-loader', 'css-loader', 'sass-loader'],
},
],
},
plugins: [new webpack.ProgressPlugin()],
optimization: {
splitChunks: {
chunks: 'all',
},
runtimeChunk: {
name: entrypoint => `runtime_${entrypoint.name}`,
},
},
},
{
entry: {
b: './src/b.js',
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: ['babel-loader'],
},
{
test: /\.(css|scss)$/,
loader: ['style-loader', 'css-loader', 'sass-loader'],
},
],
},
},
];

But hey, I'm duplicating a lot of config just for one thing. (and here it's an example, imagine a full config with hundreds of lines !).

Now I need my entry 'c' to add a special loader on js/jsx files.

My webpack.config.js looks like :

module.exports = [
{
entry: {
a: './src/a.js',
d: './src/d.js',
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: ['babel-loader'],
},
{
test: /\.(css|scss)$/,
loader: ['style-loader', 'css-loader', 'sass-loader'],
},
],
},
plugins: [new webpack.ProgressPlugin()],
optimization: {
splitChunks: {
chunks: 'all',
},
runtimeChunk: {
name: entrypoint => `runtime_${entrypoint.name}`,
},
},
},
{
entry: {
b: './src/b.js',
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: ['babel-loader'],
},
{
test: /\.(css|scss)$/,
loader: ['style-loader', 'css-loader', 'sass-loader'],
},
],
},
},
{
entry: {
c: './src/c.js',
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: ['babel-loader', 'my-loader'],
},
{
test: /\.(css|scss)$/,
loader: ['style-loader', 'css-loader', 'sass-loader'],
},
],
},
plugins: [new webpack.ProgressPlugin()],
optimization: {
splitChunks: {
chunks: 'all',
},
runtimeChunk: {
name: entrypoint => `runtime_${entrypoint.name}`,
},
},
},
];

Woaw. It's becoming hard as hell to maintain !

How should this be implemented in your opinion?

Maybe we could add a property 'scope' or something like that to have a config file like this :

module.exports = {
entry: {
a: './src/a.js',
b: './src/b.js',
c: './src/c.js',
d: './src/d.js',
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: ['babel-loader'],
},
{
scope: 'c',
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: ['babel-loader', 'my-loader'],
},
{
test: /\.(css|scss)$/,
loader: ['style-loader', 'css-loader', 'sass-loader'],
},
],
},
plugins: [new webpack.ProgressPlugin()],
optimization: {
scope: ['a', 'c', 'd'],
splitChunks: {
chunks: 'all',
},
runtimeChunk: {
name: entrypoint => `runtime_${entrypoint.name}`,
},
},
};

Are you willing to work on this yourself?

Not now because :

Maybe it's an idiot suggestion

Maybe it does already exist (but I searched really hard, I though a property 'only' was existing but I can't find it, dreaming of webpack during my sleep 😄 )

Maybe it's not in the spirit of webpack and config file

I'm don't know how webpack works under the hood, but not a problem to explore !

What do you think about this ? Any suggestions / notes are welcome ! (btw sorry for my english)

Issue 2:
Bug report

What is the current behavior?

Running webpack@5.0.0-rc.3 fails when importing rxjs (which uses tslib):

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

Details of this error are reproducible in https://github.com/philcockfield/webpack5-tslib-error

The demo repo is a minimal webpack configuration using ts-loader that imports rxjs. It also behaves this way with vanilla JS and babel loaders.

What is the expected behavior?

The page loads with no errors. This demo repo works fine with webpack@4.44.2 and then cleanly fails by flipping the version up to 5.0.0-rc.3

Other relevant information:

webpack version: 5.0.0-rc.3, 5.0.0-rc.4

Node.js version: 12.16.3

Operating System: MacOS (10.15.7)

Additional tools: -