ITADN

vue-tsc type-check error TS2304: Cannot find name 'xxxx'

#609OpenProladon 创建于 2025-11-06
P
Proladoncommented
I am aware there are many similar issues, but most of them are simply due to forgetting to add `"auto-imports.d.ts"` to the `include` array in `tsconfig`, or forgetting to run `yarn vite` first to generate `auto-imports.d.ts` before running `yarn build`. Unlike those cases, I have already included `auto-imports.d.ts` in `tsconfig (tsconfig.app.json)` and have also executed `yarn vite` to generate the file beforehand. However, when I run the type-check command (`vue-tsc --build`), I still encounter a large number of errors such as **`error TS2304: Cannot find name 'xxxx'`**. Neither `yarn vite` nor `yarn vite build` reports any errors; the error only occurs with **`vue-tsc --build`**. Here is a minimal, reproducible online project: [https://stackblitz.com/edit/vitejs-vite-tpsoknq9?file=src%2Fviews%2FHome%2FHome.vue&view=editor](https://stackblitz.com/edit/vitejs-vite-tpsoknq9?file=src%2Fviews%2FHome%2FHome.vue&view=editor) You can try the following commands: * `yarn dev` * `yarn build-only` * `yarn type-check`
1 条评论