Skip to content

Absolute Path Imports #4928

Closed
Closed
@arashkiani

Description

@arashkiani

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

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

  1. Add .env with NODE_PATH
  2. in any component expect to be able to import from NODE_PATH specified path
  3. react complain "Module not found: Can't resolve" in child component

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions