Npm:Link
lastmod 2025-02-14created 2022-05-266 edits
Mainly useful for library development.
Usage
Go to the library project folder. (Assume the library name is @projectname/api)
Go to the application project folder.
The Global Symlink for @projectname/api created first is used.
To check that it is linked correctly, see whether the library in the node_modules folder is a symbolic link.
$ ls -la node_modules/@projectname/
total 44
drwxrwxr-x 2 yourid yourid 4096 May 26 12:22 .
drwxrwxr-x 1001 yourid yourid 36864 May 26 11:35 ..
lrwxrwxrwx 1 yourid yourid 42 May 26 12:22 api -> ../../../../../.config/yarn/link/@projectname/api
If you made custom scripts
Do not use the library project's script; use the application project's script. Taking the case above as an example, if the path of @projectname/api is /home/yourid/Project/recc/api:
Link the library project:
| INFORMATION |
| For reference, with npm it is |
Link the application project:
See also
Favorite site
- yarn link | Yarn
- [Recommended] Understanding npm link