I have an NX monorepo workspace.
I have developed a library "A" with a grouping folder to contains a bunch of different domain features "x", "y", "z" and I can build them using nx build @A/x
(changing "x" with other subfolders).
I have also developed a library "B" with a grouping folder as well (containing "r", "s", "t" subfolders), that in turn depends on A library.
When I try to build B library I get tons of errors of this kind:
error TS6059: File '<my-project>/libs/<A-grouping-folder>/<x-folder>/src/lib/<some-file>' is not under 'rootDir' '<my-project>/libs/<B-grouping-folder>/<r-subfolder>/src'. 'rootDir' is expected to contain all source files.
Here is the content of tsconfig.base.json
file:
{
"compileOnSave": false,
"compilerOptions": {
"rootDir": ".",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"target": "es2015",
"module": "esnext",
"lib": ["es2017", "dom"],
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"baseUrl": ".",
"paths": {
"@A/x": ["libs/A/x/src/index.ts"],
"@A/y": ["libs/A/y/src/index.ts"],
"@A/z": ["libs/A/z/src/index.ts"],
"@B/r": ["libs/B/r/src/index.ts"],
"@B/s": ["libs/B/s/src/index.ts"],
"@B/t": ["libs/B/t/src/index.ts"],
},
"suppressImplicitAnyIndexErrors": true,
"strictPropertyInitialization": false,
"allowSyntheticDefaultImports": true,
"noImplicitAny": false,
"strictNullChecks": false,
"noImplicitReturns": false
},
"exclude": ["node_modules", "tmp"]
}
In the workspace I don't have an angular.json
file neither workspace.json
. Both libraries have a project.json
in their own "src/lib" folder.
I have read about this issue, but I'm not sure is the same. What am I doing wrong? Any idea?