question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Volar doesn't perform the source file redirect for project references

See original GitHub issue

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

  1. Clone https://github.com/segevfiner/vite-issue-1815
  2. pnpm i
  3. Open the project in VS Code.
  4. 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)
  1. 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?

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:23 (20 by maintainers)

github_iconTop GitHub Comments

1reaction
segevfinercommented, Nov 29, 2022

It seems to be working now with the new setting after setting rootDir & outDir in the library tsconfig.app.json and flipping the order in tsconfig.json between app & vitest so both the tsserver and Volar pick up tsconfig.app.json. Those are changes we might want to apply to create-vue.

0reactions
segevfinercommented, Dec 18, 2022

@johnsoncodehk Please reopen if you can reproduce the issue. It might be something wrong in tsserver with the way we set up the tsconfig in create-vue though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

LSP-volar dosn't work with the bundled volar npm dependecy
I have the volar server installed via npm and the server is located at this location: /home/predragnikolic/.cache/sublime-text/Package ...
Read more >
volar/vue-typescript - NPM Package Versions
Start using Socket to analyze @volar/vue-typescript and its 3 dependencies to ... setting for support jump to source files from reference projects (#1344) ......
Read more >
Debugging in VS Code does not work for Typescript Vue app
The problem is that the TSC has no idea that the code it is compiling actually originated from your SFC, because all it...
Read more >
Vue 3: Support new <script setup> without ref sugar - YouTrack
When using it with lang='ts' , vue dependencies are not resolved, all appears in red and no autocompletion, whilte the rest of imports...
Read more >
Chapter 20. I/O Redirection
Redirection simply means capturing output from a file, command, program, script, or even code block within a script (see Example 3-1 and Example...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found