Shorten TypeScript Imports in an Angular Project
mport { MyService } from '@services/my.service'; import { HelloWorldComponent } from '@components/hello-world.component';
// tsconfig.json in the root dir
{
"compileOnSave": false,
"compilerOptions": {
// omitted...
"baseUrl": "src",
"paths": {
"@services/*": ["app/path/to/services/*"],
"@components/*": ["app/somewhere/deeply/nested/*"],
"@environments/*": ["environments/*"]
}
}
}