Using the angular CLI, the project has been created with the following folder structure:
https://i.sstatic.net/lqGMo.png
The aim is to establish a path to a bar folder in tsconfig.app.json and import Car
to Garage
.
The tsconfig.app.json file:
{
"extends": "../tsconfig.json",
"compilerOptions": {
...
"baseUrl": "./",
"paths" : {
"@bar" : ["foo/bar"]
},
...
},
...
}
The Garage.ts file:
import { Car } from "@bar/Car";
export class Garage {}
An error is encountered in garage.ts:
Cannot find module '@bar/car'.