https://github.com/leon/labs-nx-buildable-libs
A Bug/Labs about nx buildable libs and problems with inter dependencies
https://github.com/leon/labs-nx-buildable-libs
Last synced: 12 months ago
JSON representation
A Bug/Labs about nx buildable libs and problems with inter dependencies
- Host: GitHub
- URL: https://github.com/leon/labs-nx-buildable-libs
- Owner: leon
- Created: 2021-07-02T13:18:06.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-07-02T13:38:56.000Z (almost 5 years ago)
- Last Synced: 2025-05-18T19:08:37.415Z (about 1 year ago)
- Language: JavaScript
- Size: 256 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Buildable Libs
## Setup was
create empty nx-workspace
create the two buildable libs, with these settings
```
ng generate @nrwl/workspace:library --name=domain --directory=shared --buildable --skipBabelrc --standaloneConfig --strict --testEnvironment=node --no-interactive
ng generate @nrwl/workspace:library --name=auth --directory=shared --buildable --skipBabelrc --standaloneConfig --strict --testEnvironment=node --no-interactive
```
then create a interface in domain
then a function that uses the domain
## Problem
Build the domain goes well, and I can see the correct output in dist.
```
nx build shared-domain
```
now we want to build shared auth which depends on domain
```
nx build shared-auth
// also tried, same result
nx build shared-auth --with-deps
```
**Error**
```
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';
```
According to the NX Cloud 2.0 video --with-deps was needed before, but not any longer.
since nx.json knows this itself by the new targetDependencies.
```
"targetDependencies": {
"build": [
{
"target": "build",
"projects": "dependencies"
}
]
},
```
nx dep-graph shows the correct relationship
Could it be that `@nrwl/workspace:tsc` doesn't know how to use the buildable libs?