How to Link correctly in YARN

Feb 7, 2023
A summary of how to link your local packages via yarn
So, if you ever work on a package distribution, you might sometimes want to verify a few things in the local before making an unwanted commit. So, below is a crux of how to do it properly with yarn
Lets assume you have a package pkg which you want to test it in a local repo called app . Though, you can mostly accomplish this via link, but link wont update on every change and its too complicated, i feel sometimes.
You can follow the below steps to test correctly:
  1. Get into the pkg and get the absolute path by typing pwd on mac (cd on windows). Copy it
  1. Go to the app package.json and add it as a dependency as below
dependencies: {
  1. And then run yarn in the app and you can start testing.
  1. For every change on the pkg
    1. You can remove node modules and reinstall
    2. or bump version of pkg and use yarn upgrade pkg --latest
This setup has enabled me to test faster than with yarn link and find-out why its not working as expected sometimes.
-Thank you 🙌🏻

Older Version 📦

⚠️ Still in beta. Report 🐞's here