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
../projectcin parent folder (no npm install on prod) - it not show in package.json
- so need fiddle
postinstallin package.json
- it requires
or npm install ../projectc
- cool:
- it's in package.json
- not cool:
- it requires
../projectcin parent folder (no npm install on prod) - we have
npm installeverytime change c
- it requires
so solution npm link.
you can, in project c
npm link(make sure havepackage.json).then in projects , b:
npm link module-projectc- also add dependency in
package.json
then able code comfortably while in development, ,
npm installin production scenarios.
Comments
Post a Comment