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.
答案 0 :(得分:0)
这里有一个错字,您应该在模块中有选项而不是选项->规则->使用:)
应该是这样的:
rules: [
{
test: /\.jsx?$/, // compilation to es6
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['react', 'es2015', 'es2016', 'stage-0'],
plugins: ['syntax-dynamic-import'],
},
},
},
]