[npm] npm development and debugging

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:

  1. 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:

  1. In the /npm-test (must have package.json) directory, enter the following command
npm link
  1. In the /project-demo directory, set up the soft connection:
npm link npm-test

Cancel npm link

npm unlink

Guess you like

Origin blog.csdn.net/u010682774/article/details/112669763
NPM
Recommended