Svelte Kit Import with custom Alias from ’$alias/...“
Short answer:
Add this to your file:
const path = require(“path“)
= {
kit: {
vite: {
resolve: {
alias: {
$components: (“src/components/“)
}
}
},
{
“compilerOptions“: {
“baseUrl“: “.“,
“paths“: {
“$lib/*“: [
“src/lib/*“
],
“$components/*“: [
“src/components/*“
]
Svelte Kit is BETA
I used:
svelte/kit:
svelte: ^
vite: