language-tools: Volar doesn't perform the source file redirect for project references
When’s importing a file from a project reference, Volar doesn’t redirect to the source file for completion, type checking, like the builtin tsserver support does: https://www.typescriptlang.org/tsconfig#disableSourceOfProjectReferenceRedirect. This allows type checking & auto completion, etc. To work in VS Code even before you build the dependent project’s .d.ts
.
Steps to reproduce
- Clone https://github.com/segevfiner/vite-issue-1815
pnpm i
- Open the project in VS Code.
- Open
apps/web/src/App.vue
, check the offending import line which will warn with
Output file '.../vite-library-test/packages/foo-lib/src/index.d.ts' has not been built from source file '.../vite-library-test/packages/foo-lib/src/index.ts'.ts(6305)
- Open
apps/web/src/main.ts
, notice there is no error for the same import there.
P.S. Why do I need https://github.com/segevfiner/vite-issue-1815/blob/229ca43e34e86b4d7bbb14940f7e5b00ca90dc42/apps/web/tsconfig.app.json#L10-L11 shouldn’t this be figured out from the dependency between the projects? Is this TypeScript possibly getting confused due to the tsconfig.json
not really specifying the actual output paths and them not matching with what Vite outputs?
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 24 (21 by maintainers)
Commits related to this issue
- snapshot: relate https://github.com/vuejs/language-tools/issues/1815 — committed to HenryC-3/D2N by HenryC-3 a year ago
- WIP(volar):fix ts(6305) in `.vue` file - issue: [Volar doesn't perform the source file redirect for project references · Issue #1815 · vuejs/language-tools](https://github.com/vuejs/language-tools/iss... — committed to HenryC-3/D2N by HenryC-3 a year ago
- WIP(volar):fix ts(6305) in .vue file - issue: [Volar doesn't perform the source file redirect for project references · Issue #1815 · vuejs/language-tools](vuejs/language-tools#1815) - reproduce: [Henr... — committed to HenryC-3/D2N by HenryC-3 a year ago
It seems to be working now with the new setting after setting
rootDir
&outDir
in the librarytsconfig.app.json
and flipping the order intsconfig.json
between app & vitest so both the tsserver and Volar pick uptsconfig.app.json
. Those are changes we might want to apply tocreate-vue
.