#lib
When scaffolding a new SvelteKit project through the sv CLI, it automatically creates a #lib import alias for your src/lib directory, by adding the following to your package.json:
{
"imports": {
"#lib": "./src/lib/index.js",
"#lib/*": "./src/lib/*"
}
}The # prefix leverages Node's built-in subpath imports feature, which reserves # for package-internal aliases. Vite and TypeScript both resolve these natively.
src/lib/Component.svelte
A reusable componentsrc/routes/+page.svelte
<script>
import Component from '#lib/Component.svelte';
</script>
<Component />