Building project dependencies can sometimes be a tedious task. Instead of publishing a package version to NPM and installing the dependency to test the changes, use npm link
. npm link
creates a symlink so the latest code can be tested in a local environment. This makes testing global tools and project dependencies easier by allowing the latest code run before making a published version.
NAME
npm-link - Symlink a package folder
SYNOPSIS
npm link (in package dir)
npm link [<@scope>/]<pkg>[@<version>]
alias: npm ln
When creating the dependency link, note that the package name is what is going to be referenced in the parent project.
cd ../my-dep
)npm link
npm link my-dep
or if namespaced npm link @namespace/my-dep
cd eslint-watch
)npm link
esw --quiet
Linking projects can sometimes cause issues if the dependency or global tool is already installed. npm uninstall (-g) <pkg>
and then running npm link
normally resolves any issues that may arise.