Export libraries in a publishable library
See original GitHub issueHello!
I’m currently working on a project that contains a lot of angular libraries and I need export all in a unique publishable library.
Current Behavior
I tried to add an export for each library in the barrel file of the publishable library and after run the build command the cli throw this error::
libs/a-lib/src/index.ts:2:15 - error TS6059: File ‘libs/b-lib/src/index.ts’ is not under ‘rootDir’ ‘libs/a-lib/src’. ‘rootDir’ is expected to contain all source files.
Expected Behavior
Export all libraries into just one (publishable) that can be used for other applications outside of the current nx workspace.
Steps to Reproduce
- Download the repo from here (I can’t share the original code but you can reproduce it in this demo).
- run
nx build lib-publishable
Failure Logs
Environment
OS: Windows 10 Pro
nx report:
@nrwl/angular : 9.4.4 @nrwl/cli : 9.5.1 @nrwl/cypress : 9.4.4 @nrwl/eslint-plugin-nx : Not Found @nrwl/express : Not Found @nrwl/jest : 9.4.4 @nrwl/linter : Not Found @nrwl/nest : Not Found @nrwl/next : Not Found @nrwl/node : Not Found @nrwl/react : Not Found @nrwl/schematics : Not Found @nrwl/tao : 9.5.1 @nrwl/web : Not Found @nrwl/workspace : 9.4.4 typescript : 3.8.3
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
Wanted to leave some feedback here for folks experiencing frustration around buildable libs.
The OP mentioned wanting to have a single buildable lib, whose purpose was to provide a publishable library for the rest of their workspace.
Unfortunately, by their nature, any buildable lib in your Nx Workspace may only depend on other buildable libs when it comes to importing/exporting from your local Nx Workspace. [The OP’s example repro shows the one publishable lib importing from non-buildable libs]
We are looking to include more robust feedback around this limitation (see #5054 && #5160) going forward, but this message may be useful to the OP (@AsmisAlan) or others who encounter this issue or are stuck on prior Nx versions.
Hmm, I thought it would have been related to node. It’s something we’re going to have to investigate then.