使用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

  

原文地址:https://www.cnblogs.com/ahalvxiaobu/p/15749732.html