Shin @codewithshin.com · Mar 2

I keep getting "Cannot find module '$lib' or its corresponding type declarations." on VSCode Svelte project. I tried everything but it is still there. Does anyone have the same issue?

2 likes 4 replies

?

Replies

Aleš Vaupotič · Mar 2

Are you actually exporting MyCompo from $lib/index.ts?

{🧪} +paoloricciuti.svelte · Mar 2

Is this a svelte or a sveltekit project? Because the lib alias is only setup for you in sveltekit...also did you run the dev server at least once?

Ilja · Mar 2

Just to double-check: did you try to reload the vscode session? Ctrl/Cmd+Shift+P and then search for "Reload Window“?

Shin · Mar 8

Changing "module": "NodeNext", "moduleResolution": "NodeNext" to "moduleResolution": "bundler" in tsconfig.json solved the problem.