Adding Support For Absolute Imports
When working on large projects, you may start to break your components
directory down into several domains or categories. This starts to become cumbersome as your directories grow:
import Component from "../../../../component/component";
Add the following to your jsconfig.json
or tsconfig.json
at the root of the project in order to enable absolute imports:
{
"compilerOptions": {
"baseUrl": "src"
},
...
}
This will then allow you to import from the base directory defined in the compilerOptions
above:
import Component from "component/component";