- src
|- components
||- CatComponent.js
||- DogComponent.js
- node_modules
/* src/components/DogComponent.js */
import CatComponent from 'components';
For importing from another directive to work like imports from node_modules
like above, configure webpack.
Add whichever directory in the resolve
part of the config:
resolve: {
modulesDirectories: ['src', 'node_modules']
}
And for VSCode to recognize the path, provide definition and autocomplete on click, add this to your jsconfig.js or tsconfig.js file:
{
"compilerOptions": {
"baseUrl": "src"
}
}