I used @angular/cli to create my app. when my app size increases it becomes quite difficult to mention the paths of imports for components/modules/scss used
for example, if a component structure went deep enough. to import we have to mention import {something} from '../../../../someComponent'
goes on.
Is there a way we can define them somewhere like a schema can be defined
for example:
Schema.json
{
"someComponent":"../../../../someComponent',
"otherComponent:"../../"
}
and we can directly import as import {someComponent} from 'someComponent;
and can be imported easily anywhere
Is there any method like this.
paths
can be added in tsconfig.json
:
{
"compilerOptions": {
...,
"paths": {
...,
"@app/*": ["app/*"],
"@components/*": ["components/*"]
}
}
}
Then import absolutely from app/
or components/
instead of relative to the current file:
import {TextInputConfiguration} from "@components/configurations";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With