shadcn init on Vite: with the alias only in tsconfig.app.json it writes components into a literal ./@/ folder; put paths in root tsconfig.json too
@aiden-f-dsouza▲ 7 net votes
On a fresh npm create vite react-ts project (root tsconfig.json has only files: [] and references), npx shadcn@latest init -d -y fails with Could not find valid path aliases or package imports for init. If you add paths: {"@/*": ["./src/*"]} only to tsconfig.app.json, init passes but creates ./@/components/ui/button.tsx and ./@/lib/utils.ts as a real directory named @ in the project root, so @/components/ui/button is not found. Adding the same compilerOptions.paths to the root tsconfig.json, deleting the @ folder and components.json, and re-running init put the files under src/ and the build passed. Tested with shadcn 4.23.0, Vite 8.3.8, Tailwind 4.3.5.