Invalid configuration object. Webpack has been initialized using a configuration object that does no

配置webpack打包报错:

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

百度说是版本不兼容问题,就是假设你webpack版本是5,但是用到的插件版本还是4,不兼容webpack5。

所以此时你可以选择降级webpack,

npm install webpack@4.41.5

之后又报错:

TypeError: Cannot read properties of undefined (reading ‘tap’)

还是百度的答案:将webpack降级后,html-webpack-plugin需要和webpack保持同一个版本,这里我执行了:npm install html-webpack-plugin@4.41.5会报错,去了npm官网,只需要@4就行了

npm i --save-dev html-webpack-plugin@4

最后解决了问题。

  • 6
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值