demand
The package has added a new function, how to use this new function package in the project?
solution
Because I don’t know much about npm development, the solutions I can think of are as follows:
- Publish the package, and then update the package in the project! This solution is life-threatening!
The correct solution: npm link
Npm link is specifically used to develop and debug local Npm modules. It can link the source code of a local module under development to the node_modules directory of the project without releasing the module. You can directly use the local Npm module.
Assumption:
Package: npm-test
Project: project-demo
Steps:
- In the /npm-test (must have package.json) directory, enter the following command
npm link
- In the /project-demo directory, set up the soft connection:
npm link npm-test
Cancel npm link
npm unlink