webpack--踩坑之旅

一、Insufficient number of arguments or no entry found. Alternatively, run 'webpack(-cli) --help' for usage info.
在这里插入图片描述
解决办法:检查entry项目打包入口文件路径
在这里插入图片描述
二、vue.runtime.common.dev.js:621 [Vue warn]: You are using the runtime-only build of Vue where the template compiler is not available. Either pre-compile the templates into render functions, or use the compiler-included build.(found in <Root>)

在这里插入图片描述
解决办法:webpack.config.js中添加以下代码

resolve: {
    alias: {
      'vue$': 'vue/dist/vue.esm.js'
    }
  },

三、TypeError: Cannot read property 'tap' of undefined at HtmlWebpackPlugin.apply
在这里插入图片描述
问题原因:webpack版本和html-webpack-plugin版本不一致,html-webpack-plugin版本我装的太高了,装到了5.5.0,降低版本为4.5.0后就可以了
最终版本号:
在这里插入图片描述
四、Module build failed (from ./node_modules/babel-loader/lib/index.js)
在这里插入图片描述
问题原因:babel的版本冲突
解决办法:
同时升版本或者同时降版本

1 . babel-loader 8.x | babel 7.x (升级版本)

npm install -D babel-loader @babel/core @babel/preset-env webpack

2 . babel-loader 7.x | babel 6.x (降级版本)

npm install -D babel-loader@7 babel-core babel-preset-env webpack

在这里插入图片描述

第四条参考文章:webpack 中 Module build failed (from ./node_modules/babel-loader/lib/index.js): 的错误解决

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值