The project was generated via angular CLI. I have the following folder structure:
I want to define a path to a bar folder in tsconfig.app.json and import Car
to Garage
.
My tsconfig.app.json:
{
"extends": "../tsconfig.json",
"compilerOptions": {
...
"baseUrl": "./",
"paths" : {
"@bar" : ["foo/bar"]
},
...
},
...
}
My Garage.ts:
import { Car } from "@bar/Car";
export class Garage {}
In garage.ts I have an error:
Cannot find module '@bar/car'.
You need to define paths
like that:
"paths" : {
"@bar/*" : [
"foo/bar/*"
]
},
For more information read