pnpm link
Алиасы: ln
Делает текущий локальный пакет доступным для всей системы или в другом расположении.
pnpm link <dir|pkg name>
pnpm link
Опции
pnpm link <название или путь до папки>
Links package from <dir>
directory to node_modules
of package from where you're executing this command.
For example, if you are inside
~/projects/foo
and you executepnpm link ../bar
, then a link tobar
will be created infoo/node_modules/bar
.
pnpm link
Links package from location where this command was executed to global node_modules
, so it can be referred from another package with pnpm link <pkg>
. Also if the package has a bin
field, then the package's binaries become available system-wide.
pnpm link <pkg>
Links the specified package (<pkg>
) from global node_modules
to the node_modules
of package from where this command was executed.
Use Cases
Replace an installed package with a local version of it
Let's say you have a project that uses foo
package. You want to make changes to foo
and test them in your project. In this scenario, you can use pnpm link
to link the local version of foo
to your project.
cd ~/projects/foo
pnpm install # install dependencies of foo
pnpm link # link foo globally
cd ~/projects/my-project
pnpm link foo # link foo to my-project