Cannot build buildable lib that depends on other buildable lib
See original GitHub issueCurrent Behavior
I’m getting an error when building the lib that depends on the first lib.
File '/Users/leon/Temp/labs-buildable-libs/libs/shared/domain/src/index.ts' is not under 'rootDir' 'libs/shared/auth'. 'rootDir' is expected to contain all source files.
import { User } from '@myorg/shared/domain';
it seems that even though nx knows the correct dependency, (nx dep-graph) the builder for the lib does not take into account that the other lib is buildable.
Expected Behavior
I should be able to build each library separately so I can use nx cloud to cache my libs.
Steps to Reproduce
Here is a repo with instructions and a very simple workspace to illustrate the problem. https://github.com/leon/labs-nx-buildable-libs
The repo is very light to just illustrate the problem. in my real repo we have multiple angular apps / nest.js apis and loads of workspace:library libs. The whole point of buildable libs for us will be to pre compute a lot of these libs to get a faster build. we use a lot of shared domain models that are skattered across the libs, and they sometimes extend each other, so we need to be able to build a lib, that then references the other lib.
Environment
Node : 14.17.2
OS : darwin x64
yarn : 1.22.10
nx : Not Found
@nrwl/angular : Not Found
@nrwl/cli : 12.5.1
@nrwl/cypress : Not Found
@nrwl/devkit : 12.5.1
@nrwl/eslint-plugin-nx : 12.5.1
@nrwl/express : Not Found
@nrwl/jest : 12.5.1
@nrwl/linter : 12.5.1
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : Not Found
@nrwl/react : Not Found
@nrwl/schematics : Not Found
@nrwl/tao : 12.5.1
@nrwl/web : Not Found
@nrwl/workspace : 12.5.1
@nrwl/storybook : Not Found
@nrwl/gatsby : Not Found
typescript : 4.3.5
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:8 (3 by maintainers)
This is now released, you can use 12.6.2 to get the first issue mentioned in the comment above resolved.
I’m closing this one. Please feel free to open another issue if you still have problems with this.
Interesting sidenote: The issue only appears, if the libs are inside subfolders.
Example
lib-two
depends onlib-one
This folder structure will build
And this will produce the error