-
-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VS extension Svelte for VS Code introduced errors in Version 109.00 on MacOS : absolute paths + tsconfig.json #2486
Comments
Please provide a reproduction. The bare minimum would be the copy-pasted code of the file in question and your tsconfig.json. |
This is likely similar to #2485 where the |
I'm having the same issue: the new vscode extension for svelte (v109.0.0) ignores the "paths" entry in tsconfig and breaks all "non-relative" imports in my .svelte modules. It also introduces that error about "No svelte input files were found...". You can satisfy that error by explicitly including at least one .svelte file in tsconfig, but although that stops the tsconfig error, it doesn't fix the broken imports in all svelte files the that use a "paths"-based, "non-relative" module import. By the way, I shouldn't need to do this since all of my .svelte modules are imported with import statements. (the svelte extension v108.6.1 works fine.) tsconfig.json <script lang="ts">
import AccountTree from './components/AccountTree.svelte';
import Sizer from '@bf-s/client/components/Sizer.svelte'; // <-- Cannot find module '@bf-s/client/components/Sizer.svelte' or its corresponding type declarations.ts(2307)
import AccountTreeToolbar from './components/AccountTreeToolbar.svelte';
... |
It might be you just need to restart the editor after adding svelte file to the config. We can check if something can be improved.
We're considering about changes related to this. But having svelte file in the include is still preferred. It'll be more consistent and performant.
This is that the breaking change and the "no svelte input" is for. Previously svelte file is always put into the nearest tsconfig regardless for the include config. |
Actually, I see now that only the .svelte files that are explicitly imported via tsconfig are fixed and handle the paths correctly. However, I don't want to use tsconfig that way. Yes it is more performant to include everything via tsconfig, but The reason I do it that way is because I'm pulling modules from a large local code library and many modules will not be used for any given project, so I don't want to do any blanket includes like I guess the bottom line is: tsc includes its modules either by explicitly declaring them in tsconfig, or via discovering them via the code's import statements. Shouldn't the svelte extension adhere to that as well? |
Describe the bug
(1) Svelte components imports that use absolute paths, create a
cannot find module or its corresponding type declarations ts(2307)
error in VS Code. Relative path imports work fine.(2) Opening
tsconfig.json
creates an error message :No svelte input files were found in config file „…/tsconfig.json“. Did you forget to add svelte files to the 'include' in your tsconfig.json? Specified 'include' paths were '["**/*.ts"]' and 'exclude' paths were ‚undefined'
Reproduction
Use
Svelte for VS Code
version 109.00 on MacOS 14.6.1Downgrading to the latest version 108.6.1, everything works as expected.
Expected behaviour
The errors should not appear - sounds silly, but that's it ;-).
System Info
VS Code Version 1.92.2 on MacOS 14.6.1.
Which package is the issue about?
No response
Additional Information, eg. Screenshots
No response
The text was updated successfully, but these errors were encountered: