About the configuration of loaders in webpack configuration files for beginners

self-taught to use the configuration file from a tutorial of webpack,copy a year ago, but it seems that the new version does not support the old writing. My configuration file is as follows:

module.exports = {
  entry: "./app.js",
  output: {
    filename: "bundle.js"
  },
  module: {
    loaders:[
      {
        test: /\.js[x]?$/,
        exclude: /node_modules/,
        loader: "babel-loader?presets[]=es2015&presets[]=react"
      },
    ]
  }
}

the error message is as follows:

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration.module has an unknown property "loaders". These properties are valid:
   object { exprContextCritical?, exprContextRecursive?, exprContextRegExp?, exprContextRequest?, noParse?, rules?, defaultRules?, unknownContextCritical?, unknownContextRecursive?, unknownContextRegExp?, unknownContextRequest?, unsafeCache?, wrappedContextCritical?, wrappedContextRecursive?, wrappedContextRegExp?, strictExportPresence?, strictThisContextOnImports? }
   -> Options affecting the normal modules (`NormalModuleFactory`).

ask for expert advice

Mar.02,2021

look at your loader. You want to use webpack with react. There is an options missing under your loaders.
gives you a reference (rules can also be changed to loaders):

const path =require('path');   
module.exports = {  
  entry: path.resolve(__dirname, 'index.js'),  
  output: {  
    path: path.resolve(__dirname, ''),  
    filename: "bundle.js"  
  },  
  mode: 'development',
  module: {  
    rules: [  
      {  
        test:  /\.js$/,   
        exclude: /node_modules/,  
        loader: "babel-loader",  
        options: {  
          presets: ["es2015","react"]   
        }  
      }  
    ]  
  }  
}; 
For specific configuration, you can also refer to the article I wrote earlier: https://codeshelper.com/a/11.

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1c2b28f-33a5d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1c2b28f-33a5d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?