Closed
Description
According to the links below I understand .env with NODE_PATH=src
in it, allows the react app to take advantage of Absolute Path Imports without ejecting.
so far I've managed to load REACT_APP_TEST_VAR in my process.env which indicates the file is being loaded ! but i cant import anything from src
or src/components folder
So far I've tried moving the NODE_PATH into .env && .env.development restarting node and webpack, rebooting the system
- https://medium.com/@ktruong008/absolute-imports-with-create-react-app-4338fbca7e3d
- https://medium.com/@tacomanator/environments-with-create-react-app-7b645312c09d
- https://fdp.io/blog/2018/01/18/setting-up-absolute-paths-in-create-react-app/
- Respect NODE_PATH environment variable #253
- .env NODE_PATH is not working in v1.0.0 #2230
Environment
Environment:
OS: Linux 4.15
Node: 9.10.0
Yarn: 1.7.0
npm: 6.4.0
Watchman: Not Found
Xcode: N/A
Android Studio: Not Found
Packages: (wanted => installed)
react: ^16.4.2 => 16.4.2
react-dom: ^16.4.2 => 16.4.2
react-scripts: ^1.1.5 => 1.1.5
Steps to Reproduce
- Add .env with NODE_PATH
- in any component expect to be able to import from NODE_PATH specified path
- react complain "Module not found: Can't resolve" in child component