Symlink a package folder.
Consider the example where you have test package inside node modules and you want to change in that package.
You could make changes in node_modules and manually copy the changes to the git repository of the dependency once you are done. But there is a much cleaner approach: npm link.
Package linking is a two-step process:
- Create a global symlink for a dependency with
npm link. A symlink, short for symbolic link, is a shortcut that points to another directory or file on your system.
- Tell the application to use the global symlink with
npm link test.
cd ~/projects/test npm link cd ~/projects/my-app npm link test.
The symbolic links are local and will not be committed to git. When you are ready to share your code, publish a new version of
test or push to a branch that you specify in
If you want to switch back to normal dependency even that is also super easy by
npm unlink. But npm unlink