Want to get rid of the annoying, long, boring import statements in react?
import {Card} from './../../components/Card';
Just create a jsconfig.json file in your projects root directory and the following code
{
"compilerOptions": { "baseUrl": "src" },
"include": ["src"]
}
Yaa it is that much simple to do now you can go into your file and replace the previous code with
import {Card} from 'components/Card';
Make sure you restart the server after creating the
jsconfig.jsonfile
Now do you want create
jsconfig.jsonfile all of your projects in more efficient way?Then Open up your project root directory in the terminal and run
npx react-jsconfig
It will automatically generate the
jsconfig.jsonfile for you
Top comments (0)