Using the latest SvelteKit (1.0.0-next.401) I have a problem importing components from lib using the $lib syntax. I get an error and a red squiggly line (even though the import and web app works fine).

The error message is as follows:
Cannot find module '$lib/components/shared/header.svelte' or its corresponding type declarations. js(2307)
If a use a relative path, the error disappears.
This is how I usually solve these errors:
npm run check to help the compiler figure out where things are.npm run buildI was getting this error in VS Code. After closing and reopening VS Code the error is gone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With