+1 vote
in ReactJS by

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

1 Answer

0 votes
by

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

NODE_PATH=src/app

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

Related questions

0 votes
asked Feb 14, 2023 in ReactJS by Robindeniel
0 votes
0 votes
asked Nov 8, 2023 in ReactJS by GeorgeBell
...