Open
Description
Current Behavior
Now when I run build
command in our repo with multiple publishable libs, I get error like this:
test-icons:build-lib
Bundling test-icons...
Error during bundle: Error: /Users/stupic/Documents/demos/build-lib-bug-repro/libs/test-icons/src/index.ts(2,15): semantic error TS6059: File '/Users/stupic/Documents/demos/build-lib-bug-repro/libs/test-core/src/index.ts' is not under 'rootDir' '/Users/stupic/Documents/demos/build-lib-bug-repro/libs/test-icons/src'. 'rootDir' is expected to contain all source files.
Bundle failed: test-icons
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
> NX Ran target build-lib for project test-icons (3s)
✖ 1/1 failed
✔ 0/1 succeeded [0 read from cache]
Expected Behavior
Expect to build successfully or with a better error message like: test-core
has no build-lib
target.
Steps to Reproduce
- clone the repro repo:
git clone git@github.com:SunStupic/build-lib-bug-repro.git
pnpm i
nx run test-icons:build-lib
Failure Logs
test-icons:build-lib
Bundling test-icons...
Error during bundle: Error: /Users/stupic/Documents/demos/build-lib-bug-repro/libs/test-icons/src/index.ts(2,15): semantic error TS6059: File '/Users/stupic/Documents/demos/build-lib-bug-repro/libs/test-core/src/index.ts' is not under 'rootDir' '/Users/stupic/Documents/demos/build-lib-bug-repro/libs/test-icons/src'. 'rootDir' is expected to contain all source files.
Bundle failed: test-icons
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
> NX Ran target build-lib for project test-icons (3s)
✖ 1/1 failed
✔ 0/1 succeeded [0 read from cache]
Environment
nx report
> NX Running global Nx CLI with PNPM may have issues.
Prefer to use "pnpm" (https://pnpm.io/cli/exec) to execute commands in this workspace.
TIP create a shortcut such as: alias pnx="pnpm nx --"
> NX Report complete - copy this into the issue template
Node : 16.15.1
OS : darwin x64
pnpm : 7.5.0
nx : 14.4.3
@nrwl/angular : Not Found
@nrwl/cypress : 14.4.3
@nrwl/detox : Not Found
@nrwl/devkit : Not Found
@nrwl/eslint-plugin-nx : 14.4.3
@nrwl/express : Not Found
@nrwl/jest : 14.4.3
@nrwl/js : Not Found
@nrwl/linter : 14.4.3
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : Not Found
@nrwl/nx-cloud : Not Found
@nrwl/nx-plugin : Not Found
@nrwl/react : 14.4.3
@nrwl/react-native : Not Found
@nrwl/schematics : Not Found
@nrwl/storybook : Not Found
@nrwl/web : 14.4.3
@nrwl/workspace : 14.4.3
typescript : 4.7.4
---------------------------------------
Community plugins:
Workaround
Now the workaround is simple, we need to add build-lib
for all the publishable packages or we change back to use build
.