我今天做 Angular 开发时,遇到一个很奇怪的问题:
在某个 Angular library 项目里,无法正确解析出 @Spartacus/core,

后来经过一番分析,发现是库文件夹里文件 tsconfig.json 引起的原因。
我把该文件的内容清空只剩下面一行,问题消失。


目录中存在 tsconfig.json 文件表明该目录是 TypeScript 项目的根目录。 tsconfig.json 文件指定了编译项目所需的根文件和编译器选项。
https://stackoverflow.com/questions/52147201/angular-6-declare-path-for-library-in-tsconfig-lib-json
Angular will use the tsconfig.json file, which is configured in the angular.json file in architect --> build --> options --> tsconfig. Whereas VS Code uses the tsconfig.json file, which is at the bottom of the workspace. You need to add the paths in both configurations to get both of them to work correctly, or change the project to use the base tsconfig.json file in the angular.json file.
The tsconfig.json file has a property that extends which will take another file as base and override everything which are declared in the tsconfig.lib.json file. So if you have paths declared in the tsconfig.lib.json file, then the paths are no longer needed in the tsconfig.json file.
