solid-start is unable to resolve import aliases

I've added some import aliases in tsconfig.json file. The typescript and IDE part correctly resolved it. It didn't work in the solidjs server tho. So, I modified the app.config.ts. Here's my updated part.
export default defineConfig({
ssr: true,
vite: {
resolve: {
alias: {
"@components/*": "./src/components/*",
"@ui/*": "./src/components/common/ui/*",
"@pages/*": "./src/pages/*",
"@hooks/*": "./src/hooks/*",
"@api/*": "./src/api/*",
"@libs/*": "./src/libs/*",
}
}
}
});
export default defineConfig({
ssr: true,
vite: {
resolve: {
alias: {
"@components/*": "./src/components/*",
"@ui/*": "./src/components/common/ui/*",
"@pages/*": "./src/pages/*",
"@hooks/*": "./src/hooks/*",
"@api/*": "./src/api/*",
"@libs/*": "./src/libs/*",
}
}
}
});
Still the same issue. Its not working.
1 Reply
mdynnl
mdynnl2w ago
vite.resolve.alias doesn't accept the same config as tsconfig.json's paths use https://www.npmjs.com/package/vite-tsconfig-paths and save your time it infers the correct resolve.alias from tsconfig paths https://vite.dev/config/shared-options.html#resolve-alias if you still want to configure manually simply removing wildcard * should work for that matter

Did you find this page helpful?