Tuesday, 4 April 2017

Best practice for submodules in node js

I have a project with this kind of structure:

-MyProject
--Package1
--Package2
--Package3

Each of "Package1"/"Package2"/"Package3" has its own package.json and dependencies. What will be the best practice to import one of the submodules in another submodule (let's say I want to use some "Package2" functions on "Package1" code)? What will be the best solution for dev and what would be the best solution for prod?

I thought about maybe do a link between the dependent package but that I would still have a problem on prod.. Also, I'm not sure this would be the best solution for me..

I also thought about using lerna (https://github.com/lerna/lerna) but I don't want to publish my packages on npm (unless I have to) because they are private.

Thank you!



via Roy

No comments:

Post a Comment