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
- it requires
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
- 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 install
in production scenarios.
Comments
Post a Comment