Joshua's Cheatsheets - Notes and Tips on Using yalc for Local Packages


How to Use

Here are the commands I needed to learn ASAP:

  • Initial Run:

    • yalc publish in source package, yalc add {packageName} where testing / in consumer
    • Use yalc link {packageName} for symlink version, which does not modify package.json
  • Updating:

    • Run yalc publish --push (or just yalc push) in source package to distribute updates wherever it is used
    • If files seem to get stuck, you can try:

      • yalc push --replace
      • In testing: yalc remove {packageName} && yalc add {packageName}

Fun Tips

  • yalc publish --files runs faster for me than npm publish --dry-run (this is to get a tarball / publish preview of what files would end up on NPM)

Watching for Changes

Currently, Yalc does not have a built-in way to watch for changes and relink / republish on source code updates.

The --changed flag with publish or push is to avoid redundant relinking when files have not changed. It does not watch anything.

However, there are some workarounds. The one I have personally tried is using nodemon as the watcher.

For example, here is how you could set up nodeman to run yalc push with a TypeScript package that compiles to /dist:

	"scripts": {
		"watch": "nodemon -e js,ts --ignore dist --exec \"tsc --sourceMap && yalc push --changed\""


  • Issues using bin, command not found, etc.

    • Did you make sure to run yarn or npm install after linking a new package that contributes bin entries? You can also use --npm or --yarn with yalc publish commands to trigger this.
  • Issues with Cannot find module ____

    • Try deleting your yarn.lock or package-lock.json file and then running yarn or npm install again
    • Check your lockfile (and/or node_modules) to verify the dependency is getting pulled in
Markdown Source Last Updated:
Sun Aug 23 2020 23:51:06 GMT+0000 (Coordinated Universal Time)
Markdown Source Created:
Wed Jul 29 2020 19:21:17 GMT+0000 (Coordinated Universal Time)
© 2020 Joshua Tzucker, Built with Gatsby