How to develop npm module locally

后端 未结 2 1804
滥情空心
滥情空心 2020-12-24 03:18

Lets say im working on an app, MyApp, and I want to build an NPM module for it, MyModule. Right now I can think of two ways to develop it:

  1. Makes changes -> sav
相关标签:
2条回答
  • 2020-12-24 03:45

    You're looking for the npm link command, which is a two steps process:

    1. Run npm link from your MyModule directory: this will create a global package symlinked to the MyModule directory
    2. Run npm link MyModule from your MyApp directory: this will create a MyModule folder in node_modules, symlinked to the global symlink (and thus to the real location of MyModule).
    0 讨论(0)
  • 2020-12-24 03:57

    To add on to Paul's answer, you can also do a shortcut for the above by doing the following from within your MyApp directory:

    npm link ../MyModule
    
    0 讨论(0)
提交回复
热议问题