Skip to content Skip to sidebar Skip to footer

How To Develop Npm Module Locally

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: Makes changes -> save -> npm insta

Solution 1:

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).

Solution 2:

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

Post a Comment for "How To Develop Npm Module Locally"