configuration.module has an unknown property 'loaders'

前端 未结 5 1210
生来不讨喜
生来不讨喜 2020-12-12 17:59

my output of error:

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema. -

5条回答
  •  忘掉有多难
    2020-12-12 18:09

    You should change loaders to rules in webpack 4:

    change:

    loaders 
    

    to:

    rules
    

    source: Loaders

    Example:

    module.exports = {
      module: {
        rules: [
          { test: /\.css$/, use: 'css-loader' },
          { test: /\.ts$/, use: 'ts-loader' }
        ]
      }
    };
    

提交回复
热议问题