So I have a root folder with 2 projects and I am trying to access a library project from an app using Angular 12. In my root tsconfig I have setup a path to an entry point in the library.
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"importHelpers": true,
"target": "es2015",
"module": "es2020",
"lib": [
"es2018",
"dom"
],
"paths": {
"components-lib": [
"shared-angular-components/projects/components-lib/src/public-api.ts",
],
}
}
}
When I attempt to build my app I get the error: Error: Module not found: Error: Can't resolve 'components-lib' in '/Users/scott/code/myproject/myapp/src/app'
The app's tsconfig is:
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/lib",
"target": "es2015",
"declaration": true,
"declarationMap": true,
"inlineSources": true,
"types": [],
"lib": [
"dom",
"es2018"
]
},
"angularCompilerOptions": {
"skipTemplateCodegen": true,
"strictMetadataEmit": true,
"enableResourceInlining": true
},
"exclude": [
"src/test.ts",
"**/*.spec.ts"
]
}
I verified the paths are correct and point to the public-api.ts entry point.
I can run from the app "npx tsc" and it does not give an errors so I think everything is ok from the Typescript point of view.
Am I missing something perhaps in an angular.json file or something small like that?