Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
142
rated 0 times [  146] [ 4]  / answers: 1 / hits: 11307  / 11 Years ago, thu, january 2, 2014, 12:00:00

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 -> save -> npm install /path/to/module in MyApp

  2. Same as 1, except run npm install /path/to/module then editing it directly in node_modules then copying the changes over.



What I'd like is an easier workflow. One where I can simply save the file, refresh the page, and my changes are there. Is that possible? For example, I know in Gemfiles I can just link to another directory as the path. Pretty sure I can't do that with npm tho.


More From » node.js

 Answers
5

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


[#49048] Thursday, January 2, 2014, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
albert

Total Points: 652
Total Questions: 105
Total Answers: 108

Location: Pitcairn Islands
Member since Fri, Oct 15, 2021
3 Years ago
;