DEV Community

Manav Misra
Manav Misra

Posted on

How Can I Set Up Absolute Imports in `jsconfig.json` for Create React App?

Given this setup Project directory structure

I am trying to do: import Loader from "base/Loader";

This is with Create React App, and there is a jsconfig.json like so:

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

Still, the import fails. It only works if I say, import Loader from "components/base/Loader".

Top comments (0)