【菜鸟搭建react项目之路1】【webpack】项目启动报错:configuration.module has an unknown property 'loaders'.

使用npm run server启动报错:

[webpack-cli] Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
 - configuration.module has an unknown property 'loaders'. These properties are valid:
   object { defaultRules?, exprContextCritical?, exprContextRecursive?, exprContextRegExp?, exprContextRequest?, generator?, noParse?, parser?, rules?, strictExportPresence?, strictThisContextOnImports?, unknownContextCritical?, unknownContextRecursive?, unknownContextRegExp?, unknownContextRequest?, unsafeCache?, wrappedContextCritical?, wrappedContextRecursive?, wrappedContextRegExp? }
   -> Options affecting the normal modules (`NormalModuleFactory`).
   Did you mean module.rules or module.rules.*.use?

 

解决办法:

把webpack.config.js文件里module对象下的loaders换成rules

 

posted @ 2021-11-25 23:36  leah-xx  阅读(611)  评论(0编辑  收藏  举报