Why I like using absolute imports in my react applications

preview_player
Показать описание

------------

Рекомендации по теме
Комментарии
Автор

It didn't work in my react typescript app created with Vite. I solved this by installing `vite-tsconfig-paths` module and use it as plugin in vite.config.ts file.

user_tony
Автор

I didn't even know this was a thing. Thank you so much, this most definitely is going to clean my imports up! :'D

infiniteone
Автор

Thanks, man, watched every absolute path react/next video on youtube to figure out if I should be using relative or absolute paths for files in the same directory... This is the only one I found that answered my question

chuckydigitalworldwide
Автор

Hey man, been watching on the sidelines and happy to see the well-deserved growth in your channel as of late. I feel like 10k was only just a few short months ago... well done and keep it up!

mattwebbertime
Автор

Man thanks for the info, it really helps me in my projects, I was tired of those long lines to import

sebastiancampos
Автор

This was a great tip from Mark the other day

siya.abc
Автор

This can be made clearer when using an alias like ‘~/folder/file’ or with ‘@‘ like you mentioned at the end which is my favorite way of implementing this. Another thing is that, depending on your tools (I use Vite for the most part) you can set up different aliases for different folders if that makes sense for the project.

AustinMarlar
Автор

Absolute paths are absolutely wonderful! Far easier to keep track of where everything is actually coming from without doing any mental gymnastics.

CottidaeSEA
Автор

Thank you, it was clear and very helpful. I feel I can learn so much more from your channel and daily updates sidelines, really informative and encouraging for ppl like me who is self learning react

tonywang
Автор

Failed to load resource: the server responded with a status of 500 (Internal Server Error) -this error website
vite] Internal server error: Failed to resolve import "../components/loader" from "src/pages/Home.jsx". Does the file exist?
Plugin: vite:import-analysis -this errror vscode

i had this error for 3d model import

artistdimension
Автор

how do you delete lines so quicklymlike that in vscode, also and when you copy and paste blocks

SahraClayton
Автор

Fast and smooth... firefly... Thanks a lot!

ThiagoLucioBittencourt
Автор

Amazing tip man - really appreciate this

jackh
Автор

Has anyone resolved this problem with vite and scss?

PunkSage
Автор

Have you tried nuxt 3? They have some special magic where you literally don't need to import anything

iamrooot
Автор

Good tip! But why are people still using CRA in 2022?!

peteredmonds
Автор

why we are getting build problem by using this absolute path techniques.

mdtausifiqbal
Автор

it doesn't work with how to do it can work with @

javlanbekpulatov
Автор

Great tip - I use it all the time, cause it makes the imports cleaner.
I was bashed for using it on some Discord server by a known in my country senior developer.
I just don't get it, what's wrong with it?

Will_U
Автор

Can I know your theme and font please?

محمد-مثش