项目打包提示一堆 ts 类型错误问题解决

问题

vue3 + ts 项目在打包的过程中报了一大堆 ts 类型错误提示,如下图所示:

报错:Could not find a declaration file for module ... implicitly has an 'any' type.

解决方法

查看 package.json 文件,可以看到,默认 build 是会对 ts 代码进行检查的

我们只需要将 ts 代码检测配置去掉即可,去掉后代码:

复制代码
"scripts": {
    "dev": "vite",
    "build": "vite build",
    "preview": "vite preview"
  },
相关推荐
ruanCat1 小时前
Prettier 明明执行成功,Markdown 为什么还是没变?一次插件误诊复盘
前端·javascript·node.js
软件开发技术深度爱好者2 小时前
在线学习实践 TypeScript 的官方Playground(演练场)使用介绍
javascript·学习·typescript