unplugin / unplugin-auto-import

Auto import APIs on-demand for Vite, Webpack and Rollup
MIT License
3.21k stars 195 forks source link

希望增加生成声明文件的命令 #496

Open WangJincheng4869 opened 4 months ago

WangJincheng4869 commented 4 months ago

Clear and concise description of the problem

目前自动导入的逻辑是需要访问页面才能生成对应的声明,这样就会导致在 build 的时候会报错。

图片

Suggested solution

如果能在 build 之前调用一下下生成导入就不会有这个问题。

 "scripts": {
    "build": "auto-import && vue-tsc --noEmit && vite build",
  }

Alternative

No response

Additional context

No response

Validations

l246804 commented 4 months ago

这是 vue-tsc --noEmit 检查出的问题,我理解 unplugin-auto-import 依赖于 vite 的模块扫描,不运行 vite 就没法生成类型文件吧?所以我直接都是构建时删掉类型检查,需要时(提交代码)再自动检查类型😂。

ThereWeGo commented 1 week ago

同样的需求, 希望添加单独生成的命令, 比如这种命令, 能否type-check 通过, 完全依赖于 build 触发d.ts 生成的时机, 很容易导致cicd失败 "build:prod": "pnpm i && run-p type-check \"build-only {@}\" -- --mode prod"