Webpack configuration object validation error: "loader" must be a string

I use Webpack Validator to validate my Webpack Config object, and this gives me the following error:

[1] "loader" must be a string

Here is my Webpack configuration object:

  const config = webpackValidator({
    context: resolve('client'),
    entry: {
      app: './app.js',
      vendor: ['./app.css'],
    },
    output: {
      filename: ifProd('bundle.[name].[chunkhash].js', 'bundle.[name].js'),
      path: resolve('dist'),
      pathinfo: ifNotProd(),
    },
    devtool: ifProd('source-map', 'eval'),
    module: {
      loaders: [
        {test: /\.js$/, loaders: ['babel-loader'], exclude: /node_modules/},
        {test: /\.jsx$/, loaders: ['babel-loader'], exclude: /node_modules/},
        {
          test: /\.css$/, loader: ExtractTextPlugin.extract({
            fallbackLoader: 'style-loader',
            loader: 'css-loader'
          })
        },
      ],
    },
    plugins: removeEmpty([
      new ProgressBarPlugin(),
      new ExtractTextPlugin(ifProd('styles.[name].[chunkhash.css]', 'styles.[name].css')),
      ifProd(new InlineManifestWebpackPlugin()),
      ifProd(new webpack.optimize.CommonsChunkPlugin({
        name: ['vendor', 'manifest'],
      })),
      new HtmlWebpackPlugin({
        template: './index.html',
        inject: 'head',
      }),
    ]),
  })

Any understanding would be greatly appreciated!

+4
source share

Source: https://habr.com/ru/post/1668213/


All Articles