nystudio107 / annotated-webpack-config

This is the companion github repo for the "An Annotated webpack 4 Config for Frontend Web Development" article.
https://nystudio107.com/blog/an-annotated-webpack-4-config-for-frontend-web-development
MIT License
435 stars 75 forks source link

error with latest build using babelLoaderConfig and cacheDuration #15

Closed TomDeSmet closed 5 years ago

TomDeSmet commented 5 years ago

I cannot run development mode but I'm not getting any error either. When trying the build command I get this error:

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration[0].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[0].module.rules[0] has an unknown property 'cacheDirectory'. These properties are valid:
      object { compiler?, enforce?, exclude?, include?, issuer?, loader?, loaders?, oneOf?, options?, parser?, query?, resolve?, resource?, resourceQuery?, rules?, sideEffects?, test?, type?, use? }
    * configuration[0].module.rules[0].exclude should be an instance of RegExp
    * configuration[0].module.rules[0].exclude: The provided value "" is not an absolute path!
    * configuration[0].module.rules[0].exclude should be an instance of function
    * configuration[0].module.rules[0].exclude should be an array:
      [RegExp | string | function | [(recursive)] | object { and?, exclude?, include?, not?, or?, test? }]
    * configuration[0].module.rules[0].exclude should be an object.
    * configuration[0].module.rules[0].exclude should be an array:
      [RegExp | string | function | [(recursive)] | object { and?, exclude?, include?, not?, or?, test? }]
 - configuration[1].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[1].module.rules[0] has an unknown property 'cacheDirectory'. These properties are valid:
      object { compiler?, enforce?, exclude?, include?, issuer?, loader?, loaders?, oneOf?, options?, parser?, query?, resolve?, resource?, resourceQuery?, rules?, sideEffects?, test?, type?, use? }
    * configuration[1].module.rules[0].exclude should be an instance of RegExp
    * configuration[1].module.rules[0].exclude: The provided value "" is not an absolute path!
    * configuration[1].module.rules[0].exclude should be an instance of function
    * configuration[1].module.rules[0].exclude should be an array:
      [RegExp | string | function | [(recursive)] | object { and?, exclude?, include?, not?, or?, test? }]
    * configuration[1].module.rules[0].exclude should be an object.
    * configuration[1].module.rules[0].exclude should be an array:
      [RegExp | string | function | [(recursive)] | object { and?, exclude?, include?, not?, or?, test? }]

When I change

exclude: settings.babelLoaderConfig.exclude,
cacheDirectory: true,

back to

exclude: /node_modules/,

it works again.

khalwat commented 5 years ago

Fixed this to set it to [] by default in 1.0.3