Setup path aliases w/ React + Vite + TS Alexander Kim on April 30, 2022 Out of the box vite doesn't provide "@" path alias to src, so we have to manually setup it. I suppose you're using Vite preset for react-ts. Steps... Read full post Submit Preview Dismiss Collapse Expand Anna Anna Anna Follow Developer Advocate @ Stripe. Former frontend engineer turned agent wrangler @ AWS. Full-stack human. Location Portland Education Lots of it, most of it irrelevant to my current career Pronouns she/her Work Developer Advocate @ Stripe Joined Nov 15, 2018 • May 21 '22 Dropdown menu Copy link Hide Does this work for nested paths? I'm trying to do something like this, and the nested folder isn't working for me: { "compilerOptions": { "baseUrl": ".", ... "paths": { "*": ["src/*", "node_modules/*"], "components/*": ["src/components/*"], "containers/*": ["src/containers/*"], "pages/*": ["src/constants/*"], "store/*": ["src/store/*"], "types/*": ["src/types/*"], "NestedFolder/*": [ "src/components/NestedFolder/*" ], } }, "include": ["src/**/*", "*"] } Enter fullscreen mode Exit fullscreen mode Collapse Expand Hari Shekhar Hari Shekhar Hari Shekhar Follow Joined Dec 7, 2018 • Jan 22 '23 Dropdown menu Copy link Hide Hi @anna For multiple aliases, you can follow this answer on stackoverflow. stackoverflow.com/a/75201776/3144344 Collapse Expand Guilherme Soldateli Guilherme Soldateli Guilherme Soldateli Follow Location Brazil Work Frontend Engineer at Self-employed Joined Oct 26, 2020 • Oct 7 '22 Dropdown menu Copy link Hide So helpful, thanks! Collapse Expand Jonas Tolentino Jonas Tolentino Jonas Tolentino Follow developing solutions to make the world a better place Location Cambé, PR - Brasil Education --- Work software engineer Joined Oct 23, 2022 • Feb 20 '23 • Edited on Feb 20 • Edited Dropdown menu Copy link Hide Thank you very much... but what if I want to use it in the pattern import Container from '@components/Container' how would the configuration look? Collapse Expand Rahmat Sulistio Rahmat Sulistio Rahmat Sulistio Follow Location Indonesia Joined Dec 3, 2020 • Jan 12 '23 Dropdown menu Copy link Hide how we can add auto suggestions for VS Code? Collapse Expand celedonio2151 celedonio2151 celedonio2151 Follow I am a software developer, my favorite languages are Javascript, Python. I love developing with reactjs and nodejs Location Sucre, Bolivia Education University USFX Pronouns Skyline Joined Feb 2, 2021 • Nov 9 '24 Dropdown menu Copy link Hide Does anyone know how to add auto suggestions? Auto suggestions work with javascript for importing, but not with typescript? Collapse Expand Thales Bruno Thales Bruno Thales Bruno Follow Fullstack Engineer Location Brazil Education Bachelor's Degree in Computer Science Pronouns he, him Joined Jul 1, 2019 • Jan 15 '23 Dropdown menu Copy link Hide Thanks for that ❤️ Collapse Expand Amit Mondal Amit Mondal Amit Mondal Follow Software Engineer · FullStack · Building GenAI Products at Scale | SenseHawk (Reliance) | Ex-Paytm Location India Education Bachelor of Engineering in Information Technology Work Fullstack Developer Joined Jan 25, 2020 • Sep 3 '22 • Edited on Sep 3 • Edited Dropdown menu Copy link Hide This really helped, Thanks Collapse Expand Petar Kolev Petar Kolev Petar Kolev Follow Senior Software Engineer with React && TypeScript Location Bulgaria Work Senior Software Engineer @ alkem.io Joined Nov 27, 2019 • Nov 8 '22 Dropdown menu Copy link Hide Wow, thanks a lot Alex! It sure did the work done <3 Collapse Expand Miguel Angel Muñoz Miguel Angel Muñoz Miguel Angel Muñoz Follow I help digital agencies, startups and entrepreneurs deliver faster, scale smarter, and impress their clients, without burning out their dev team. Email thewintherdmc@gmail.com Location Medellin, Colombia Education Software Engineer at UNIR Work Mid. Frontend Software Engineer Joined May 22, 2023 • Aug 9 '24 Dropdown menu Copy link Hide Nice! Thank you so. much I was blocked with this error. Collapse Expand IamSoPradaYou IamSoPradaYou IamSoPradaYou Follow Hello! I a, beginner in front-end dev! Let's talk! Location Saint-Petersburg, Russia Work Junior Joined Aug 14, 2020 • May 8 '22 Dropdown menu Copy link Hide Thank you so much! That really helped me, spent half of my day trying to resolve problems with using aliases. Collapse Expand pjosxyz pjosxyz pjosxyz Follow Joined Feb 13, 2023 • Feb 13 '23 Dropdown menu Copy link Hide Awesome, worked a charm :) Code of Conduct • Report abuse
Does this work for nested paths? I'm trying to do something like this, and the nested folder isn't working for me:
Hi @anna
For multiple aliases, you can follow this answer on stackoverflow.
stackoverflow.com/a/75201776/3144344
So helpful, thanks!
Thank you very much...
but what if I want to use it in the pattern
import Container from '@components/Container'how would the configuration look?
how we can add auto suggestions for VS Code?
Does anyone know how to add auto suggestions? Auto suggestions work with javascript for importing, but not with typescript?
Thanks for that ❤️
This really helped, Thanks
Wow, thanks a lot Alex! It sure did the work done <3
Nice! Thank you so. much I was blocked with this error.
Thank you so much! That really helped me, spent half of my day trying to resolve problems with using aliases.
Awesome, worked a charm :)