I created a new Angular project with one application project and a library project. When I tried to import dependencies/components of the library project into the main application project using VSCode's intellisense, it's including the path *project/app_name/src/public-api" instead of just the name of the library/project. enter image description here How do I configure it in the angular.json so that it only shows the library name? Here's my angular.json config. I didn't do anything to it, it's just the default generated by the Angular CLI. enter image description here

1 Answers

0
Chunbin Li On

You can use path mapping by configuring your tsconfig.json as follows:

{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "public-api/*": ["../projects/app_name/src/public-api/*"],
    }
  }
}