<h2 dir="auto">Feature request</h2>





<p dir="auto">Hello all,<br>
I have an idea of new feature based on my personnal experience with webpack :<br>
It seems that it is not possible to define usage of plugins, rules, optimization or something else on some specials entries.</p>
<p dir="auto"><strong>What is the expected behavior?</strong></p>
<p dir="auto">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.</p>
<p dir="auto"><strong>What is motivation or use case for adding/changing the behavior?</strong></p>
<p dir="auto">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.</p>
<p dir="auto">Examples :</p>
<p dir="auto">here we have 4 entries, imagine that I need to optimize all entries, but i don't want entry 'b' to be.</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="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 =&gt; `runtime_${entrypoint.name}`,
    },
  },
};"><pre class="notranslate"><span class="pl-smi">module</span><span class="pl-kos">.</span><span class="pl-c1">exports</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span>
  <span class="pl-c1">entry</span>: <span class="pl-kos">{</span>
    <span class="pl-c1">a</span>: <span class="pl-s">'./src/a.js'</span><span class="pl-kos">,</span>
    <span class="pl-c1">b</span>: <span class="pl-s">'./src/b.js'</span><span class="pl-kos">,</span>
    <span class="pl-c1">c</span>: <span class="pl-s">'./src/c.js'</span><span class="pl-kos">,</span>
    <span class="pl-c1">d</span>: <span class="pl-s">'./src/d.js'</span><span class="pl-kos">,</span>
  <span class="pl-kos">}</span><span class="pl-kos">,</span>
  <span class="pl-c1">module</span>: <span class="pl-kos">{</span>
    <span class="pl-c1">rules</span>: <span class="pl-kos">[</span>
      <span class="pl-kos">{</span>
        <span class="pl-c1">test</span>: <span class="pl-pds"><span class="pl-c1">/</span><span class="pl-cce">\.</span><span class="pl-kos">(</span>js<span class="pl-c1">|</span>jsx<span class="pl-kos">)</span><span class="pl-cce">$</span><span class="pl-c1">/</span></span><span class="pl-kos">,</span>
        <span class="pl-c1">exclude</span>: <span class="pl-pds"><span class="pl-c1">/</span>node_modules<span class="pl-c1">/</span></span><span class="pl-kos">,</span>
        <span class="pl-c1">use</span>: <span class="pl-kos">[</span><span class="pl-s">'babel-loader'</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
      <span class="pl-kos">}</span><span class="pl-kos">,</span>
      <span class="pl-kos">{</span>
        <span class="pl-c1">test</span>: <span class="pl-pds"><span class="pl-c1">/</span><span class="pl-cce">\.</span><span class="pl-kos">(</span>css<span class="pl-c1">|</span>scss<span class="pl-kos">)</span><span class="pl-cce">$</span><span class="pl-c1">/</span></span><span class="pl-kos">,</span>
        <span class="pl-c1">loader</span>: <span class="pl-kos">[</span><span class="pl-s">'style-loader'</span><span class="pl-kos">,</span> <span class="pl-s">'css-loader'</span><span class="pl-kos">,</span> <span class="pl-s">'sass-loader'</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
      <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-kos">]</span><span class="pl-kos">,</span>
  <span class="pl-kos">}</span><span class="pl-kos">,</span>
  <span class="pl-c1">plugins</span>: <span class="pl-kos">[</span><span class="pl-k">new</span> <span class="pl-s1">webpack</span><span class="pl-kos">.</span><span class="pl-c1">ProgressPlugin</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
  <span class="pl-c1">optimization</span>: <span class="pl-kos">{</span>
    <span class="pl-c1">splitChunks</span>: <span class="pl-kos">{</span>
      <span class="pl-c1">chunks</span>: <span class="pl-s">'all'</span><span class="pl-kos">,</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-c1">runtimeChunk</span>: <span class="pl-kos">{</span>
      <span class="pl-en">name</span>: <span class="pl-s1">entrypoint</span> <span class="pl-c1">=&gt;</span> <span class="pl-s">`runtime_<span class="pl-s1"><span class="pl-kos">${</span><span class="pl-s1">entrypoint</span><span class="pl-kos">.</span><span class="pl-c1">name</span><span class="pl-kos">}</span></span>`</span><span class="pl-kos">,</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>
  <span class="pl-kos">}</span><span class="pl-kos">,</span>
<span class="pl-kos">}</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">Here, I can deal with array :</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="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 =&gt; `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'],
        },
      ],
    },
  },
];"><pre class="notranslate"><span class="pl-smi">module</span><span class="pl-kos">.</span><span class="pl-c1">exports</span> <span class="pl-c1">=</span> <span class="pl-kos">[</span>
  <span class="pl-kos">{</span>
    <span class="pl-c1">entry</span>: <span class="pl-kos">{</span>
      <span class="pl-c1">a</span>: <span class="pl-s">'./src/a.js'</span><span class="pl-kos">,</span>
      <span class="pl-c1">c</span>: <span class="pl-s">'./src/c.js'</span><span class="pl-kos">,</span>
      <span class="pl-c1">d</span>: <span class="pl-s">'./src/d.js'</span><span class="pl-kos">,</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-c1">module</span>: <span class="pl-kos">{</span>
      <span class="pl-c1">rules</span>: <span class="pl-kos">[</span>
        <span class="pl-kos">{</span>
          <span class="pl-c1">test</span>: <span class="pl-pds"><span class="pl-c1">/</span><span class="pl-cce">\.</span><span class="pl-kos">(</span>js<span class="pl-c1">|</span>jsx<span class="pl-kos">)</span><span class="pl-cce">$</span><span class="pl-c1">/</span></span><span class="pl-kos">,</span>
          <span class="pl-c1">exclude</span>: <span class="pl-pds"><span class="pl-c1">/</span>node_modules<span class="pl-c1">/</span></span><span class="pl-kos">,</span>
          <span class="pl-c1">use</span>: <span class="pl-kos">[</span><span class="pl-s">'babel-loader'</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
        <span class="pl-kos">}</span><span class="pl-kos">,</span>
        <span class="pl-kos">{</span>
          <span class="pl-c1">test</span>: <span class="pl-pds"><span class="pl-c1">/</span><span class="pl-cce">\.</span><span class="pl-kos">(</span>css<span class="pl-c1">|</span>scss<span class="pl-kos">)</span><span class="pl-cce">$</span><span class="pl-c1">/</span></span><span class="pl-kos">,</span>
          <span class="pl-c1">loader</span>: <span class="pl-kos">[</span><span class="pl-s">'style-loader'</span><span class="pl-kos">,</span> <span class="pl-s">'css-loader'</span><span class="pl-kos">,</span> <span class="pl-s">'sass-loader'</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
        <span class="pl-kos">}</span><span class="pl-kos">,</span>
      <span class="pl-kos">]</span><span class="pl-kos">,</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-c1">plugins</span>: <span class="pl-kos">[</span><span class="pl-k">new</span> <span class="pl-s1">webpack</span><span class="pl-kos">.</span><span class="pl-c1">ProgressPlugin</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
    <span class="pl-c1">optimization</span>: <span class="pl-kos">{</span>
      <span class="pl-c1">splitChunks</span>: <span class="pl-kos">{</span>
        <span class="pl-c1">chunks</span>: <span class="pl-s">'all'</span><span class="pl-kos">,</span>
      <span class="pl-kos">}</span><span class="pl-kos">,</span>
      <span class="pl-c1">runtimeChunk</span>: <span class="pl-kos">{</span>
        <span class="pl-en">name</span>: <span class="pl-s1">entrypoint</span> <span class="pl-c1">=&gt;</span> <span class="pl-s">`runtime_<span class="pl-s1"><span class="pl-kos">${</span><span class="pl-s1">entrypoint</span><span class="pl-kos">.</span><span class="pl-c1">name</span><span class="pl-kos">}</span></span>`</span><span class="pl-kos">,</span>
      <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>
  <span class="pl-kos">}</span><span class="pl-kos">,</span>
  <span class="pl-kos">{</span>
    <span class="pl-c1">entry</span>: <span class="pl-kos">{</span>
      <span class="pl-c1">b</span>: <span class="pl-s">'./src/b.js'</span><span class="pl-kos">,</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-c1">module</span>: <span class="pl-kos">{</span>
      <span class="pl-c1">rules</span>: <span class="pl-kos">[</span>
        <span class="pl-kos">{</span>
          <span class="pl-c1">test</span>: <span class="pl-pds"><span class="pl-c1">/</span><span class="pl-cce">\.</span><span class="pl-kos">(</span>js<span class="pl-c1">|</span>jsx<span class="pl-kos">)</span><span class="pl-cce">$</span><span class="pl-c1">/</span></span><span class="pl-kos">,</span>
          <span class="pl-c1">exclude</span>: <span class="pl-pds"><span class="pl-c1">/</span>node_modules<span class="pl-c1">/</span></span><span class="pl-kos">,</span>
          <span class="pl-c1">use</span>: <span class="pl-kos">[</span><span class="pl-s">'babel-loader'</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
        <span class="pl-kos">}</span><span class="pl-kos">,</span>
        <span class="pl-kos">{</span>
          <span class="pl-c1">test</span>: <span class="pl-pds"><span class="pl-c1">/</span><span class="pl-cce">\.</span><span class="pl-kos">(</span>css<span class="pl-c1">|</span>scss<span class="pl-kos">)</span><span class="pl-cce">$</span><span class="pl-c1">/</span></span><span class="pl-kos">,</span>
          <span class="pl-c1">loader</span>: <span class="pl-kos">[</span><span class="pl-s">'style-loader'</span><span class="pl-kos">,</span> <span class="pl-s">'css-loader'</span><span class="pl-kos">,</span> <span class="pl-s">'sass-loader'</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
        <span class="pl-kos">}</span><span class="pl-kos">,</span>
      <span class="pl-kos">]</span><span class="pl-kos">,</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>
  <span class="pl-kos">}</span><span class="pl-kos">,</span>
<span class="pl-kos">]</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">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 !).</p>
<p dir="auto">Now I need my entry 'c' to add a special loader on js/jsx files.<br>
My webpack.config.js looks like :</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="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 =&gt; `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 =&gt; `runtime_${entrypoint.name}`,
      },
    },
  },
];"><pre class="notranslate"><span class="pl-smi">module</span><span class="pl-kos">.</span><span class="pl-c1">exports</span> <span class="pl-c1">=</span> <span class="pl-kos">[</span>
  <span class="pl-kos">{</span>
    <span class="pl-c1">entry</span>: <span class="pl-kos">{</span>
      <span class="pl-c1">a</span>: <span class="pl-s">'./src/a.js'</span><span class="pl-kos">,</span>
      <span class="pl-c1">d</span>: <span class="pl-s">'./src/d.js'</span><span class="pl-kos">,</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-c1">module</span>: <span class="pl-kos">{</span>
      <span class="pl-c1">rules</span>: <span class="pl-kos">[</span>
        <span class="pl-kos">{</span>
          <span class="pl-c1">test</span>: <span class="pl-pds"><span class="pl-c1">/</span><span class="pl-cce">\.</span><span class="pl-kos">(</span>js<span class="pl-c1">|</span>jsx<span class="pl-kos">)</span><span class="pl-cce">$</span><span class="pl-c1">/</span></span><span class="pl-kos">,</span>
          <span class="pl-c1">exclude</span>: <span class="pl-pds"><span class="pl-c1">/</span>node_modules<span class="pl-c1">/</span></span><span class="pl-kos">,</span>
          <span class="pl-c1">use</span>: <span class="pl-kos">[</span><span class="pl-s">'babel-loader'</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
        <span class="pl-kos">}</span><span class="pl-kos">,</span>
        <span class="pl-kos">{</span>
          <span class="pl-c1">test</span>: <span class="pl-pds"><span class="pl-c1">/</span><span class="pl-cce">\.</span><span class="pl-kos">(</span>css<span class="pl-c1">|</span>scss<span class="pl-kos">)</span><span class="pl-cce">$</span><span class="pl-c1">/</span></span><span class="pl-kos">,</span>
          <span class="pl-c1">loader</span>: <span class="pl-kos">[</span><span class="pl-s">'style-loader'</span><span class="pl-kos">,</span> <span class="pl-s">'css-loader'</span><span class="pl-kos">,</span> <span class="pl-s">'sass-loader'</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
        <span class="pl-kos">}</span><span class="pl-kos">,</span>
      <span class="pl-kos">]</span><span class="pl-kos">,</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-c1">plugins</span>: <span class="pl-kos">[</span><span class="pl-k">new</span> <span class="pl-s1">webpack</span><span class="pl-kos">.</span><span class="pl-c1">ProgressPlugin</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
    <span class="pl-c1">optimization</span>: <span class="pl-kos">{</span>
      <span class="pl-c1">splitChunks</span>: <span class="pl-kos">{</span>
        <span class="pl-c1">chunks</span>: <span class="pl-s">'all'</span><span class="pl-kos">,</span>
      <span class="pl-kos">}</span><span class="pl-kos">,</span>
      <span class="pl-c1">runtimeChunk</span>: <span class="pl-kos">{</span>
        <span class="pl-en">name</span>: <span class="pl-s1">entrypoint</span> <span class="pl-c1">=&gt;</span> <span class="pl-s">`runtime_<span class="pl-s1"><span class="pl-kos">${</span><span class="pl-s1">entrypoint</span><span class="pl-kos">.</span><span class="pl-c1">name</span><span class="pl-kos">}</span></span>`</span><span class="pl-kos">,</span>
      <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>
  <span class="pl-kos">}</span><span class="pl-kos">,</span>
  <span class="pl-kos">{</span>
    <span class="pl-c1">entry</span>: <span class="pl-kos">{</span>
      <span class="pl-c1">b</span>: <span class="pl-s">'./src/b.js'</span><span class="pl-kos">,</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-c1">module</span>: <span class="pl-kos">{</span>
      <span class="pl-c1">rules</span>: <span class="pl-kos">[</span>
        <span class="pl-kos">{</span>
          <span class="pl-c1">test</span>: <span class="pl-pds"><span class="pl-c1">/</span><span class="pl-cce">\.</span><span class="pl-kos">(</span>js<span class="pl-c1">|</span>jsx<span class="pl-kos">)</span><span class="pl-cce">$</span><span class="pl-c1">/</span></span><span class="pl-kos">,</span>
          <span class="pl-c1">exclude</span>: <span class="pl-pds"><span class="pl-c1">/</span>node_modules<span class="pl-c1">/</span></span><span class="pl-kos">,</span>
          <span class="pl-c1">use</span>: <span class="pl-kos">[</span><span class="pl-s">'babel-loader'</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
        <span class="pl-kos">}</span><span class="pl-kos">,</span>
        <span class="pl-kos">{</span>
          <span class="pl-c1">test</span>: <span class="pl-pds"><span class="pl-c1">/</span><span class="pl-cce">\.</span><span class="pl-kos">(</span>css<span class="pl-c1">|</span>scss<span class="pl-kos">)</span><span class="pl-cce">$</span><span class="pl-c1">/</span></span><span class="pl-kos">,</span>
          <span class="pl-c1">loader</span>: <span class="pl-kos">[</span><span class="pl-s">'style-loader'</span><span class="pl-kos">,</span> <span class="pl-s">'css-loader'</span><span class="pl-kos">,</span> <span class="pl-s">'sass-loader'</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
        <span class="pl-kos">}</span><span class="pl-kos">,</span>
      <span class="pl-kos">]</span><span class="pl-kos">,</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>
  <span class="pl-kos">}</span><span class="pl-kos">,</span>
  <span class="pl-kos">{</span>
    <span class="pl-c1">entry</span>: <span class="pl-kos">{</span>
      <span class="pl-c1">c</span>: <span class="pl-s">'./src/c.js'</span><span class="pl-kos">,</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-c1">module</span>: <span class="pl-kos">{</span>
      <span class="pl-c1">rules</span>: <span class="pl-kos">[</span>
        <span class="pl-kos">{</span>
          <span class="pl-c1">test</span>: <span class="pl-pds"><span class="pl-c1">/</span><span class="pl-cce">\.</span><span class="pl-kos">(</span>js<span class="pl-c1">|</span>jsx<span class="pl-kos">)</span><span class="pl-cce">$</span><span class="pl-c1">/</span></span><span class="pl-kos">,</span>
          <span class="pl-c1">exclude</span>: <span class="pl-pds"><span class="pl-c1">/</span>node_modules<span class="pl-c1">/</span></span><span class="pl-kos">,</span>
          <span class="pl-c1">use</span>: <span class="pl-kos">[</span><span class="pl-s">'babel-loader'</span><span class="pl-kos">,</span> <span class="pl-s">'my-loader'</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
        <span class="pl-kos">}</span><span class="pl-kos">,</span>
        <span class="pl-kos">{</span>
          <span class="pl-c1">test</span>: <span class="pl-pds"><span class="pl-c1">/</span><span class="pl-cce">\.</span><span class="pl-kos">(</span>css<span class="pl-c1">|</span>scss<span class="pl-kos">)</span><span class="pl-cce">$</span><span class="pl-c1">/</span></span><span class="pl-kos">,</span>
          <span class="pl-c1">loader</span>: <span class="pl-kos">[</span><span class="pl-s">'style-loader'</span><span class="pl-kos">,</span> <span class="pl-s">'css-loader'</span><span class="pl-kos">,</span> <span class="pl-s">'sass-loader'</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
        <span class="pl-kos">}</span><span class="pl-kos">,</span>
      <span class="pl-kos">]</span><span class="pl-kos">,</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-c1">plugins</span>: <span class="pl-kos">[</span><span class="pl-k">new</span> <span class="pl-s1">webpack</span><span class="pl-kos">.</span><span class="pl-c1">ProgressPlugin</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
    <span class="pl-c1">optimization</span>: <span class="pl-kos">{</span>
      <span class="pl-c1">splitChunks</span>: <span class="pl-kos">{</span>
        <span class="pl-c1">chunks</span>: <span class="pl-s">'all'</span><span class="pl-kos">,</span>
      <span class="pl-kos">}</span><span class="pl-kos">,</span>
      <span class="pl-c1">runtimeChunk</span>: <span class="pl-kos">{</span>
        <span class="pl-en">name</span>: <span class="pl-s1">entrypoint</span> <span class="pl-c1">=&gt;</span> <span class="pl-s">`runtime_<span class="pl-s1"><span class="pl-kos">${</span><span class="pl-s1">entrypoint</span><span class="pl-kos">.</span><span class="pl-c1">name</span><span class="pl-kos">}</span></span>`</span><span class="pl-kos">,</span>
      <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>
  <span class="pl-kos">}</span><span class="pl-kos">,</span>
<span class="pl-kos">]</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">Woaw. It's becoming hard as hell to maintain !</p>
<p dir="auto"><strong>How should this be implemented in your opinion?</strong></p>
<p dir="auto">Maybe we could add a property 'scope' or something like that to have a config file like this :</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="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 =&gt; `runtime_${entrypoint.name}`,
    },
  },
};"><pre class="notranslate"><span class="pl-smi">module</span><span class="pl-kos">.</span><span class="pl-c1">exports</span> <span class="pl-c1">=</span> <span class="pl-kos">{</span>
  <span class="pl-c1">entry</span>: <span class="pl-kos">{</span>
    <span class="pl-c1">a</span>: <span class="pl-s">'./src/a.js'</span><span class="pl-kos">,</span>
    <span class="pl-c1">b</span>: <span class="pl-s">'./src/b.js'</span><span class="pl-kos">,</span>
    <span class="pl-c1">c</span>: <span class="pl-s">'./src/c.js'</span><span class="pl-kos">,</span>
    <span class="pl-c1">d</span>: <span class="pl-s">'./src/d.js'</span><span class="pl-kos">,</span>
  <span class="pl-kos">}</span><span class="pl-kos">,</span>
  <span class="pl-c1">module</span>: <span class="pl-kos">{</span>
    <span class="pl-c1">rules</span>: <span class="pl-kos">[</span>
      <span class="pl-kos">{</span>
        <span class="pl-c1">test</span>: <span class="pl-pds"><span class="pl-c1">/</span><span class="pl-cce">\.</span><span class="pl-kos">(</span>js<span class="pl-c1">|</span>jsx<span class="pl-kos">)</span><span class="pl-cce">$</span><span class="pl-c1">/</span></span><span class="pl-kos">,</span>
        <span class="pl-c1">exclude</span>: <span class="pl-pds"><span class="pl-c1">/</span>node_modules<span class="pl-c1">/</span></span><span class="pl-kos">,</span>
        <span class="pl-c1">use</span>: <span class="pl-kos">[</span><span class="pl-s">'babel-loader'</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
      <span class="pl-kos">}</span><span class="pl-kos">,</span>
      <span class="pl-kos">{</span>
        <span class="pl-c1">scope</span>: <span class="pl-s">'c'</span><span class="pl-kos">,</span>
        <span class="pl-c1">test</span>: <span class="pl-pds"><span class="pl-c1">/</span><span class="pl-cce">\.</span><span class="pl-kos">(</span>js<span class="pl-c1">|</span>jsx<span class="pl-kos">)</span><span class="pl-cce">$</span><span class="pl-c1">/</span></span><span class="pl-kos">,</span>
        <span class="pl-c1">exclude</span>: <span class="pl-pds"><span class="pl-c1">/</span>node_modules<span class="pl-c1">/</span></span><span class="pl-kos">,</span>
        <span class="pl-c1">use</span>: <span class="pl-kos">[</span><span class="pl-s">'babel-loader'</span><span class="pl-kos">,</span> <span class="pl-s">'my-loader'</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
      <span class="pl-kos">}</span><span class="pl-kos">,</span>
      <span class="pl-kos">{</span>
        <span class="pl-c1">test</span>: <span class="pl-pds"><span class="pl-c1">/</span><span class="pl-cce">\.</span><span class="pl-kos">(</span>css<span class="pl-c1">|</span>scss<span class="pl-kos">)</span><span class="pl-cce">$</span><span class="pl-c1">/</span></span><span class="pl-kos">,</span>
        <span class="pl-c1">loader</span>: <span class="pl-kos">[</span><span class="pl-s">'style-loader'</span><span class="pl-kos">,</span> <span class="pl-s">'css-loader'</span><span class="pl-kos">,</span> <span class="pl-s">'sass-loader'</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
      <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-kos">]</span><span class="pl-kos">,</span>
  <span class="pl-kos">}</span><span class="pl-kos">,</span>
  <span class="pl-c1">plugins</span>: <span class="pl-kos">[</span><span class="pl-k">new</span> <span class="pl-s1">webpack</span><span class="pl-kos">.</span><span class="pl-c1">ProgressPlugin</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
  <span class="pl-c1">optimization</span>: <span class="pl-kos">{</span>
    <span class="pl-c1">scope</span>: <span class="pl-kos">[</span><span class="pl-s">'a'</span><span class="pl-kos">,</span> <span class="pl-s">'c'</span><span class="pl-kos">,</span> <span class="pl-s">'d'</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
    <span class="pl-c1">splitChunks</span>: <span class="pl-kos">{</span>
      <span class="pl-c1">chunks</span>: <span class="pl-s">'all'</span><span class="pl-kos">,</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-c1">runtimeChunk</span>: <span class="pl-kos">{</span>
      <span class="pl-en">name</span>: <span class="pl-s1">entrypoint</span> <span class="pl-c1">=&gt;</span> <span class="pl-s">`runtime_<span class="pl-s1"><span class="pl-kos">${</span><span class="pl-s1">entrypoint</span><span class="pl-kos">.</span><span class="pl-c1">name</span><span class="pl-kos">}</span></span>`</span><span class="pl-kos">,</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>
  <span class="pl-kos">}</span><span class="pl-kos">,</span>
<span class="pl-kos">}</span><span class="pl-kos">;</span></pre></div>
<p dir="auto"><strong>Are you willing to work on this yourself?</strong></p>
<p dir="auto">Not now because :</p>
<ul dir="auto">
<li>Maybe it's an idiot suggestion</li>
<li>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 😄 )</li>
<li>Maybe it's not in the spirit of webpack and config file</li>
<li>I'm don't know how webpack works under the hood, but not a problem to explore !</li>
</ul>
<p dir="auto">What do you think about this ? Any suggestions / notes are welcome ! (btw sorry for my english)</p>
<h1 dir="auto">Bug report</h1>




<p dir="auto"><strong>What is the current behavior?</strong></p>
<p dir="auto">Running <code class="notranslate">webpack@5.0.0-rc.3</code> fails when importing <code class="notranslate">rxjs</code> (which uses <code class="notranslate">tslib</code>):</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/185555/95528689-57f2b380-0a35-11eb-966f-6aa9ab6167a0.png"><img src="https://user-images.githubusercontent.com/185555/95528689-57f2b380-0a35-11eb-966f-6aa9ab6167a0.png" alt="image" style="max-width: 100%;"></a></p>
<hr>
<p dir="auto"><strong>If the current behavior is a bug, please provide the steps to reproduce.</strong></p>
<p dir="auto">Details of this error are reproducible in <a href="https://github.com/philcockfield/webpack5-tslib-error">https://github.com/philcockfield/webpack5-tslib-error</a><br>
The demo repo is a minimal webpack configuration using <code class="notranslate">ts-loader</code> that imports <code class="notranslate">rxjs</code>.  It also behaves this way with vanilla JS and babel loaders.</p>






<hr>
<p dir="auto"><strong>What is the expected behavior?</strong><br>
The page loads with no errors.  This <a href="https://github.com/philcockfield/webpack5-tslib-error">demo repo</a> works fine with <code class="notranslate">webpack@4.44.2</code> and then cleanly fails by flipping the version up to <code class="notranslate">5.0.0-rc.3</code></p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/185555/95528726-6e007400-0a35-11eb-85d9-95c270c85d2f.png"><img src="https://user-images.githubusercontent.com/185555/95528726-6e007400-0a35-11eb-85d9-95c270c85d2f.png" alt="image" style="max-width: 100%;"></a></p>


<hr>
<p dir="auto"><strong>Other relevant information:</strong><br>
webpack version:  5.0.0-rc.3, 5.0.0-rc.4<br>
Node.js version: 12.16.3<br>
Operating System: MacOS (10.15.7)<br>
Additional tools: -</p>