DEV Community

loading...

Discussion on: Configuring absolute paths in React for Web without ejecting [en-US]

Collapse
zarabotaet profile image
Dima

In cra 3 this stuff out of the box.
facebook.github.io/create-react-ap...
In cra 2 you can use env variable.

Collapse
averyfreeman profile image
Avery Freeman

Now instead of NODE_PATH=src in .env, React and NextJS are using jsconfig.json - just place this in the project root:

{
"compilerOptions": {
"baseUrl": "src"
},
"include": ["src"]
}

Reference: create-react-app.dev/docs/importin...