使用webpack打包TS时报错

npm run dev 启动项目时报错

 

 

解决方法:指定html-webpack-plugin的版本。一般最新版的webpack兼容性不太好,所以一般会下载低版本的webpack,那么就导致你下载的webpack与html-webpack-plugin不匹配。

所以指定一下html-webpack-plugin的版本

npm install -D html-webpack-plugin@4.5.0

  

 

 解决方法:指定ts-loader的版本。

 npm install -D ts-loader@4.4.2

  

posted @ 2021-12-30 17:17  博客天天写  阅读(834)  评论(0编辑  收藏  举报