New: Cookbooks and AI ExplanationsStep-by-Step recipes to solve problems connected to Roadmaps and Cheat Sheets. Need more details? Use AI buttons for structured and simple explanations with concrete examples throughout the whole platform.Take a look
It imports fine in the editor. Then the build fails.
What you'll have at the end
The same @/ import working in the editor, the dev server and the production build
You need
A Vite and TypeScript project with an alias like @/ already mapped in the project's own compiler settings and used in at least one real import.
Not covered
Getting the exact same alias working inside a separate test runner or a Node script outside the bundler, which each read module specifiers through their own, different resolver.
Leans on
Why can't TypeScript find types for a package you just installed?
for when the checker itself is unhappy about a missing shape, rather than the bundler being unable to find a file the checker already accepted.
Why your Vite build 404s right after deploy
for when every asset 404s right after a deploy instead of one aliased import failing to resolve, which is a base-path problem rather than a mapping one.
Checked 22 Aug 2026
Part of the TypeScript cookbook