0

I have 2 NPM packages that I'm developing, one of them is for TypeScript interfaces and the other one is for Typed mongoose schemas.
In some cases I want to update the interfaces locally, then continue developing the schemas according to most updated interfaces so I used `npm link` on the interfaces and inside the schemas lib I used `npm link @interaces-lib` - it works perfect.

Then when I finish working on the schemas I want to use npm link there too and use BOTH the interfaces lib and the schemas lib in another project which should use both of them, but when I try to link the schemas lib, it links it but not with the latest locally developed interfaces-lib in the node_modules folder but the one that was there before I linked it.

Any idea how to solve it?

Thanks!

Raz Levy
  • 138
  • 1
  • 9
  • You might want to take a look at monorepos and how to use them with TypeScript. They would certainly save you from the pain of having to link local packages. – kelsny Jul 20 '22 at 14:48
  • I've had some trouble in the past when linking multiple libraries after each other and found that you cann pass multiple arguments to npm link like `npm link library-1 library-2`. Not sure if this helps in your case but for me it fixed some problems. – Grochni Jul 20 '22 at 15:12
  • @Grochni I'm not sure you understood the issue, I know I can pass multiple arguments to npm link, but once I link library-2 (in your example) to library-1, and then link library-1 (which should now have library-2 linked) it resets library-2 in library-1's node_modules. – Raz Levy Jul 23 '22 at 10:31

0 Answers0