-
-
Notifications
You must be signed in to change notification settings - Fork 230
Description
Describe the bug
I have a SvelteKit project on my Debian machine, and I access it through a symbolic link.
On my editor (Kate, but I have also tried on VS Code), importing anything from the $lib folder into a .svelte file causes this error:
Cannot find module '$lib/example' or its corresponding type declarations.
Importing from $lib into .ts files works well though.
Reproduction
I recreated a SvelteKit + Typescript project from scratch, with this src structure:
src/
├─ lib/
│ ├─ test.ts
│ ├─ test.svelte
│ ├─ example.ts
I export a const value in example.ts, and then import it in the other files. So in my example example.ts contains:
export const example = 1;And test.svelte:
<script lang="ts">
import { example } from "$lib/example"; // this import is not resolved
console.log(example);
</script>I open my editor with a command like this:
code ~/symlink-to-my-project/src/lib/test.svelteI let all the other files by default. My attempts to use a preprocessor and aliases in svelte.config.js or to set verbatimModuleSyntax and preserveSymlinks in tsconfig.json didn’t help me.
Expected behaviour
Having no error when I import from $lib folder
System Info
- OS: Debian
- IDE: VS 1.108.2 with Svelte for VS Code 109.13.0
Also had the issue with Kate + svelte-language-server 0.17.25
Which package is the issue about?
svelte-language-server
Additional Information, eg. Screenshots
Thanks for any help! I can live without using this symlink but I thought it was worth reporting it.