Has anyone ever run into…

2 minute read

Has anyone ever run into an issue where one lib changing does not affect another when the latter imports the former? Specific case is this:

app1 imports lib1 which imports lib2

I affected lib2 but app1 was not affected. So I ran the affected dep graph command which showed that nothing depends on the lib2 node. I reran the affected dep draph but with the –files flag pointing at lib1 and it showed that app1 depends on lib1.

All of app1 lib1 and lib2 have records in angular.json and nx.json as well as tsconfig but I cannot for the life of me figure out why it doesn’t show app1 as affected when lib2 changes.

Responses:

i have the same issue for dep-graph, can’t figure the graph out

but the lib that depends on each other needs to have the path specified to dist folder….of the other lib

and when u build, got to build multiple, this is only for –publishable libs My question to you is, is your lib publishable? Yes –> All the other libs that it is referencing have to be publishable,

"paths": {       "@flowaccount/*" : [         "dist/@flowaccount/*"       ]     } in tsconfig.app.json to reference to other libs

No this lib is not publishable. it is just a feature lib

I’m not too familiar with how Nx understands the dependencies. I know that you can define “implicitDependencies” through nx.json, but I guess that imports are also taken into account (?)

Are you sure that your cross-lib imports always use the path mappings?

only if its publishable

i checked, it no publishable it should be fine

but how i did it was, i add paths to the main tslib.confg

but implicitDependencies might be the way

i cheated a bit, out of hurry :stuck_out_tongue:

I shouldn’t need to add any extra implicit dependencies because there is a TS import connecting these libs

I figured it out. And I thnk it might be a bug.

the ts alias was @scope/directory-feature instead of @scope/directory/feature that was the only thing that was different and once changed to the latter (the ts alias pointed to the right code and everything with the hyphenated version before) my dep graph is now displaying than affecting lib2 affects app1

Ow :stuck_out_tongue: Nice catch

Thanks, I am going to try and recreate it in a repo and submit it to the Nrwl team. I feel like that is not intended as I would assume you should be able to have whatever you want (within reason) as a ts alias. I think this one was never changed after we did a bunch of refactoring into libraries and thats why it didnt follow the same rules as when generated using Nx

K was able to recreate it in a minimal repo.

Updated: