Contributing to node modules

Writing this down since it always takes me a while to piece together after I’ve forgotten it. Basically local development of npm modules is all npm link

  1. Clone the module somewhere locally
  2. cd into the module directory
  3. run npm link
  4. cd into some project using the module
  5. run npm link module-name

To clean this up afterwards, run npm unlink.

If you’re working on a dependency of a dependency, directly install the public version of that module before linking (I think?). Newer versions of NPM use a flat dependency graph and it should all just work. (couldn’t find a reference on this, sorry)

Leave a comment