Using Yalc as an alternative to npm link

- Posted in webdev

This is mostly a reference for myself. For some technical things I tend to use my own blog if I forget something.

This is an example of how to use Yalc as an alternative to npm link . I find that npm link doesn’t always do what it should, and I found yalc to work better.

First, install Yalc:

npm i yalc -g

(1) Go to your dependency project’s folder, make a branch, do yalc publish

(2) Then go to child project where you use the dependency, install it there with yalc add <projectname> (it replaces the version package.json with your local version)

(3) Restart your project – typically you will have to stop/start the server (Ctrl+C / npm run dev)

I do this with 3 terminal tabs, juggling between those 3 actions. Yalc puts the packages in a temporary .yalc folder on your local computer.

(I discovered Yalc through this post. Thanks Viget!)

Leave a Reply

Your email address will not be published. Required fields are marked *