node.js - npm local modules vs prod -


we developping 2 modules depending on one. a -› b , c -› b

i dug solutions available now:

from projects a, b npm link ../projectc

  • cool:
    • it's symlink, changing file in c passed on , b
  • not cool:
    • it requires ../projectc in parent folder (no npm install on prod)
    • it not show in package.json
    • so need fiddle postinstall in package.json

or npm install ../projectc

  • cool:
    • it's in package.json
  • not cool:
    • it requires ../projectc in parent folder (no npm install on prod)
    • we have npm install everytime change c

so solution npm link.

  1. you can, in project c npm link (make sure have package.json).

  2. then in projects , b:

    • npm link module-projectc
    • also add dependency in package.json
  3. then able code comfortably while in development, , npm install in production scenarios.


Comments

Popular posts from this blog

javascript - How to diff two immutable objects -

c# - How can I have the VS Debugger break in the correct location for exceptions thrown in Async methods in a Console App? -

javascript - React.js: onClick function from child to parent -