Quantcast
Channel: Active questions tagged config - Stack Overflow
Viewing all articles
Browse latest Browse all 5049

How to fix this error in webpack: configuration.module.rules[9].exclude[0]: The provided value "node_modules" is not an absolute path?

$
0
0

There is an error after updating webpack version to the latest:

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration.module.rules[9].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[9].exclude[0]: The provided value "node_modules" is not an absolute path!
* configuration.module.rules[9].exclude[0]: The provided value "node_modules" is not an absolute path!

And the "webpack.loaders.js" file is like this:

module.exports = [
 {
  test: /\.jsx?$/,
  exclude: /(node_modules|bower_components|public\/)/,
  loader: "babel-loader"
 },
 {
  test: /\.css$/,
  loaders: ['style-loader', 'css-loader?importLoaders=1'],
  exclude: [/node_modules/]
 },
 {
  test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
  exclude: /(node_modules|bower_components)/,
  loader: "file-loader"
 },
 {
  test: /\.(woff|woff2)$/,
  exclude: /(node_modules|bower_components)/,
  loader: "url-loader?prefix=font/&limit=5000"
 },
 {
  test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
  exclude: /(node_modules|bower_components)/,
  loader: "url-loader?limit=10000&mimetype=application/octet-stream"
 },
 {
  test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
  exclude: /(node_modules|bower_components)/,
  loader: "url-loader?limit=10000&mimetype=image/svg+xml"
 },
 {
  test: /\.gif/,
  exclude: /(node_modules|bower_components)/,
  loader: "url-loader?limit=10000&mimetype=image/gif"
 },
 {
  test: /\.jpg/,
  exclude: /(node_modules|bower_components)/,
  loader: "url-loader?limit=10000&mimetype=image/jpg"
 },
 {
  test: /\.png/,
  exclude: /(node_modules|bower_components)/,
  loader: "url-loader?limit=10000&mimetype=image/png"
 }
];

As you can see there are only 9 items in the array, however webpack's showing error for the 10th item (with index 9). What is the problem?


Viewing all articles
Browse latest Browse all 5049

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>