Closed spacedawwwg closed 1 month ago
.vue-global-types/vue_3.5_false.d.ts
should exist directly in node_modules.
I have a similar problem, which might be related. In a PNPM monorepo I have one library and an app. The app includes some library files using relative paths, like ../../library/src/somefile.vue
.
.vue-global-types/vue_3.5_false.d.ts
is created inside app/node_modules
, but not for the library or the repo root, which causes this error for files imported from library. I've previously used vue-tsc 1.8.27, which worked fine with this setup.
I tried to fiddle with vite-plugin-checker's vueTsc root/tsconfigPath options, but couldn't get the file to be generated to repo root node_modules.
pnpm + monorepo, vue-tsc check UnoIcon.vue
Error at .pnpm/@unocss
ERROR(vue-tsc) Cannot find type definition file for '.vue-global-types/vue_3.5_false.d.ts'.
FILE /Volumes/...../node_modules/.pnpm/@unocss+nuxt@0.62.4_magicast@0.3.5_postcss@8.4.47_rollup@4.22.0_webpack-sources@3.2.3_webpack@5.94.0_esbuild@0.23.1_/node_modules/@unocss/nuxt/runtime/UnoIcon.vue:4:23
2 | <div />
3 | </template>
> 4 | /// <reference types=".vue-global-types/vue_3.5_false.d.ts" />
My workaround was to not point on the other package via relative path but via node modules mananged by pnpm.
So I've replaced:
../../packages/my-package
by
node_modules/@company/my-package
in my TypeScript alias
in my case, i downgrade the pnpm as follows, but i am not sure if it is all pnpm reson,
shared-workspace-lockfile
=falseand, when using workspace:*
protocol,
e.g. monorepo front
deps on "common":"workspace:*"
,
sometimes, in front
project, regenerate .nuxt
will no error :P
rm -rf .nuxt
pnpm dev
same problem in pnpm monorepo.
Error happens when trying import .vue file in another package.
For example, when executing vue-tsc
in /apps/my-app, it will generate .vue-global-types/vue_3.4_false.d.ts
in /apps/my-app/node_modules.
Then we import my-lib/src/some-comp.vue
which locates in /lib/my-lib
, it cannot find a vue_3.4_false.d.ts
for some-comp.vue
since they are in different folders.
/apps
/node_modules
/.vue-global-types
main.ts
/my-lib
/node_modules
[missing .vue-global-types]
/src
some-comp.vue
viewed source code, seems like it'll put .vue-global-types/vue_3.4_false.d.ts
on the same level of vue
in node_modules
.
But it's not guaranteed this file will be resolved by all triple slash of files from anywhere:
yield `/// <reference types=".vue-global-types/${options.vueCompilerOptions.lib}_${options.vueCompilerOptions.target}_${options.vueCompilerOptions.strictTemplates}.d.ts" />${newLine}`;
Anyone got any idea to fix this?
Is there any workaround before the PR is merged? (btw nice work @depressedX!!!)
Is there any workaround before the PR is merged? (btw nice work @depressedX!!!)
You use use pnpm-patch
(or other third party library patch tool) to add changes in this PR to your project. And that's exactly how I did in my project.
Vue - Official extension or vue-tsc version
2.1.6
VSCode version
1.93.1
Vue version
3.5.6
TypeScript version
5.3.3
System Info
package.json dependencies
No response
Steps to reproduce
We're using a PNPM monorepo, each package has it's own type check. We run the these using Turborepo. The issue still happens randomly even type checking individual packages.
We're also using typescript references.
What is expected?
.vue-global-types/vue_3.5_false.d.ts is found
What is actually happening?
.vue-global-types/vue_3.5_false.d.ts is not found
Link to minimal reproduction
No response
Any additional comments?
We've tried adding
directly to the tsconfig's and also tried adding
This didn't seem to help