Symlink a package folder during development.
For development, a package can be linked into another project. This is often useful to test out new features or when trying to debug an issue in a package that manifests itself in another project.
There are two commands to facilitate this workflow:
This command is run in the package folder you’d like to consume. For example if you
are working on
react and would like to use your local version to debug a
react-relay, simply run
yarn link inside of the
yarn link [package] to link another package that you’d like to test into
your current project. To follow the above example, in the
yarn link react to use your local version of
react that you
Complete example, assuming two project folders
react-relay next to each other:
$ cd react $ yarn link yarn link vx.x.x success Registered "react". info You can now run `yarn link "react"` in the projects where you want to use this module and it will be used instead.
$ cd ../react-relay $ yarn link react yarn link vx.x.x success Registered "react".
This will create a symlink named
react-relay/node_modules/react that links to
your local copy of the
Links are registered in
~/.config/yarn/link. If you want to specify a different folder you can run the command with this syntax
yarn link --link-folder path/to/dir/
To reverse this process, simply use
yarn unlink or
yarn unlink [package]. Also see:
yarn unlink: unlink a linked package.