我在 webpack.config.js 中遇到这个问题

ham*_*ama 4 reactjs webpack

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration.module.rules[0] has an unknown property 'option'. These properties are valid:    object { compiler?, enforce?, exclude?, include?, issuer?, loader?, loaders?, oneOf?, options?, parser?, query?, resolve?, resource?, resourceQuery?, rules?, sideEffects?, test?, type?, use? }    -> A rule npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! app.js@0.0.2 webpack: `webpack` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the app.js@0.0.2 webpack script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

小智 9

你这里有一个拼写错误,你应该有选项而不是模块中的选项 - >规则 - >使用:)

应该是这样的:

rules: [
      {
        test: /\.jsx?$/, // compilation to es6
        exclude: /node_modules/,
        use: {
          loader: 'babel-loader',
          options: {
            presets: ['react', 'es2015', 'es2016', 'stage-0'],
            plugins: ['syntax-dynamic-import'],
          },
        },
      },
]
Run Code Online (Sandbox Code Playgroud)