错误内容是:

> cross-env NODE_ENV=development webpack-dev-server --config webpack.config.js --progress --color

× 「wds」: Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
 - configuration.devtool should match pattern "^(inline-|hidden-|eval-)?(nosources-)?(cheap-(module-)?)?source-map$".
   BREAKING CHANGE since webpack 5: The devtool option is more strict.
   Please strictly follow the order of the keywords in the pattern.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev: `cross-env NODE_ENV=development webpack-dev-server --config webpack.config.js --progress --color`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     D:\Node\Node12.18.4\node-cache\_logs\2020-10-30T07_36_43_424Z-debug.log

 

大概的意思是说:检查devtool的匹配,webpack5要求的匹配更严格,所以需要重新考虑下配置,在网上找的资料地址为:

https://stackoverflow.com/questions/62591440/webpack-5-devtool-validationerror-invalid-configuration-object

打开较慢,我附图片:

webpack5学习中的报错:configuration.devtool should match pattern

webpack5学习中的报错:configuration.devtool should match pattern

我开始的配置我给注释掉了,重新编辑了下:

webpack5学习中的报错:configuration.devtool should match pattern

相关文章:

  • 2021-06-02
  • 2021-10-06
  • 2022-12-23
  • 2022-12-23
  • 2021-05-18
猜你喜欢
  • 2021-06-28
  • 2022-12-23
  • 2021-04-18
  • 2021-08-05
  • 2021-12-06
相关资源
相似解决方案