<p dir="auto">I recently moved to webpack from require.js and some node_module have .min files built in. When I use a file from node_module I just do <code class="notranslate">require('my-module')</code> and it loads it right away without any config. But this will load the development version or a bigger version.</p>
<p dir="auto">For example react is loaded <code class="notranslate">require('react/addons')</code> but this is not the minified version.</p>
<p dir="auto">My question is:</p>
<ul dir="auto">
<li>Should I load modules normally and then minify everything?</li>
<li>Should I use their .min files provided and then minify everything again? (in this way I save a lot of disk)</li>
<li>Any better way? Would be nice to automatically loade minified files.</li>
</ul>
<p dir="auto">For now, I'm changing the aliases of webpack to load the minified version when building the app:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="myConfig.resolve.alias.phaserUnFixed = &quot;nodeModules/phaser/build/custom/phaser-no-physics.min.js&quot;;
myConfig.resolve.alias.react = &quot;nodeModules/react/dist/react-with-addons.min.js&quot;;
myConfig.resolve.alias.lodash = &quot;nodeModules/lodash/dist/lodash.compat.min.js&quot;;
myConfig.resolve.alias.moment = &quot;nodeModules/moment/min/moment.min.js&quot;;"><pre class="notranslate"><code class="notranslate">myConfig.resolve.alias.phaserUnFixed = "nodeModules/phaser/build/custom/phaser-no-physics.min.js";
myConfig.resolve.alias.react = "nodeModules/react/dist/react-with-addons.min.js";
myConfig.resolve.alias.lodash = "nodeModules/lodash/dist/lodash.compat.min.js";
myConfig.resolve.alias.moment = "nodeModules/moment/min/moment.min.js";
</code></pre></div>
<p dir="auto">But this is not a good approach either... Can you think of anything better?</p>
<h1 dir="auto">Bug report</h1>
<p dir="auto">Hello I had in my package.json<br>
<code class="notranslate">^4.17.2</code></p>
<p dir="auto">It auto upgraded to <code class="notranslate">4.20.3</code> and then I get the error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration.module.rules[0].exclude should be one of these:
   RegExp | string | function | [(recursive)] | object { and?, exclude?, include?, not?, or?, test? } | [RegExp | string | function | [(recursive)] | object { and?, exclude?, include?, not?, or?, test? }]
   -&gt; One or multiple rule conditions
   Details:
    * configuration.module.rules[0].exclude should be an instance of RegExp
    * configuration.module.rules[0].exclude should be a string.
    * configuration.module.rules[0].exclude should be an instance of function
    * configuration.module.rules[0].exclude[0] should be an instance of RegExp
    * configuration.module.rules[0].exclude[0]: The provided value &quot;node_modules&quot; is not an absolute path!
    * configuration.module.rules[0].exclude[0] should be an instance of function
    * configuration.module.rules[0].exclude[0] should be an array:
      [RegExp | string | function | [(recursive)] | object { and?, exclude?, include?, not?, or?, test? }]
    * configuration.module.rules[0].exclude[0] should be an object.
    * configuration.module.rules[0].exclude should be an object.
    * configuration.module.rules[0].exclude[0] should be an instance of RegExp
    * configuration.module.rules[0].exclude[0]: The provided value &quot;node_modules&quot; is not an absolute path!
    * configuration.module.rules[0].exclude[0] should be an instance of function
    * configuration.module.rules[0].exclude[0] should be an array:
      [RegExp | string | function | [(recursive)] | object { and?, exclude?, include?, not?, or?, test? }]
    * configuration.module.rules[0].exclude[0] should be an object.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! p2@0.0.1 dist: `cross-env PRODUCTION=true node_modules/.bin/webpack`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the p2@0.0.1 dist script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above."><pre class="notranslate"><code class="notranslate">Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration.module.rules[0].exclude should be one of these:
   RegExp | string | function | [(recursive)] | object { and?, exclude?, include?, not?, or?, test? } | [RegExp | string | function | [(recursive)] | object { and?, exclude?, include?, not?, or?, test? }]
   -&gt; One or multiple rule conditions
   Details:
    * configuration.module.rules[0].exclude should be an instance of RegExp
    * configuration.module.rules[0].exclude should be a string.
    * configuration.module.rules[0].exclude should be an instance of function
    * configuration.module.rules[0].exclude[0] should be an instance of RegExp
    * configuration.module.rules[0].exclude[0]: The provided value "node_modules" is not an absolute path!
    * configuration.module.rules[0].exclude[0] should be an instance of function
    * configuration.module.rules[0].exclude[0] should be an array:
      [RegExp | string | function | [(recursive)] | object { and?, exclude?, include?, not?, or?, test? }]
    * configuration.module.rules[0].exclude[0] should be an object.
    * configuration.module.rules[0].exclude should be an object.
    * configuration.module.rules[0].exclude[0] should be an instance of RegExp
    * configuration.module.rules[0].exclude[0]: The provided value "node_modules" is not an absolute path!
    * configuration.module.rules[0].exclude[0] should be an instance of function
    * configuration.module.rules[0].exclude[0] should be an array:
      [RegExp | string | function | [(recursive)] | object { and?, exclude?, include?, not?, or?, test? }]
    * configuration.module.rules[0].exclude[0] should be an object.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! p2@0.0.1 dist: `cross-env PRODUCTION=true node_modules/.bin/webpack`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the p2@0.0.1 dist script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
</code></pre></div>
<p dir="auto"><strong>What is the current behavior?</strong></p>
<p dir="auto">I downgraded to <code class="notranslate">~4.17.2</code></p>
<p dir="auto">I didnt suppose you'd release a breaking change<br>
and such one,</p>
<p dir="auto"><code class="notranslate">webpack.config.js</code></p>
<p dir="auto">relevant part</p>
<p dir="auto"><code class="notranslate">exclude: ['node_modules']</code></p>