How to avoid using relative path imports in create-react-app?

Posted by Prem Tiwari | Updated on

How to avoid using relative path imports in create-react-app?

Create a file called .env in the project root and write the import path:

After that restart the development server. Now you should be able to import anything inside src/app without relative paths.


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers