0

I'm trying to link my angular 13 project as a ui-component library. I've built the project and have the package in a dist folder. Next, I linked it to my main project (angular 14) using "yarn link" and I can see it is properly added as a dependency in my node_modules folder.

My problem is that I keep getting errors (image attached) on the browser from the components imported from my UI library.

PS: The ui-library is also published to npm and works as expected when installed from the registry, but I would like to be able to use it for development locally as well.

enter image description here

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
Oyekeye Sam
  • 73
  • 2
  • 8

1 Answers1

0

You can try the following:

Build your angular library component. After building navigate into the dist/ folder and then into the library-folder/ inside the dist folder..So technically after this your path must be dist\component-library. Once you are in that folder in the command prompt/terminal/vs code terminal, hit npm link and then head to your project where you want to use this component library and hit npm link component-library-name and then it will link it.

If the link is not yet working, for your local changes only, remove the component library from your package.json and see if that works. Make sure you are not actually deploying that change.

Srikar Phani Kumar M
  • 1,069
  • 1
  • 3
  • 8