question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Export libraries in a publishable library

See original GitHub issue

Hello!

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

  1. Download the repo from here (I can’t share the original code but you can reproduce it in this demo).
  2. 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:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
ZackDeRosecommented, Mar 29, 2021

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.

1reaction
Cammisulicommented, Aug 18, 2020

Hmm, I thought it would have been related to node. It’s something we’re going to have to investigate then.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Buildable and Publishable Libraries - Nx
One particularity when generating a library with --publishable is that it requires you to also provide an --importPath . Your import path is...
Read more >
Importing a publishable library into another library Fails Angular
My Main tsconfig file contains all the proper imports . I build both the libraries using Angular cli command ng g library <name>....
Read more >
Libraries — Pine Script™ v5 User Manual v5 documentation
You can browse the library scripts published publicly by members in TradingView's ... You can export user-defined types (UDTs) from libraries, and library...
Read more >
Guide to libraries in Figma
Browse published styles and components in the library modal and enable libraries to access them in drafts and team or organization files.
Read more >
Building and Publishing Angular Libraries - YouTube
In this live stream, we will see: # Setting up Nx mono-repo for libraries # Creating Buildable libraries # Creating Publishable libraries # ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found