After update to 4.20.3 webpack configuration schema has changed

Bug report

Hello I had in my package.json
^4.17.2

It auto upgraded to 4.20.3 and then I get the error:

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? }]
   -> 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.

What is the current behavior?

I downgraded to ~4.17.2

I didnt suppose you’d release a breaking change
and such one,

webpack.config.js

relevant part

exclude: ['node_modules']

Author: Fantashit

1 thought on “After update to 4.20.3 webpack configuration schema has changed

  1. exclude: ['node_modules'] is not valid. It has to be either:

    exclude: [/node_modules/] or exclude: [path.resolve(__dirname, 'node_modules')]

Comments are closed.