Reputation: 323
I am starting a JavaScript project and its parent directory contains 2 folders: client
and server
. Both of these will require Javascript packages but I'm confused as to whether I should make a node_modules
folder in each of them for their respective dependencies or whether I should create only one and install all the packages there. Basically what I'm asking is whether I should do this:
or this:
Upvotes: 2
Views: 2385
Reputation: 8783
I should make a node_modules folder in each of them for their respective dependencies or whether I should create only one and install all the packages there.
As you have client
- Frontend and server
- Backend which are two different side of things and they will have their own dependencies with package.json
. You might be installing some specific packages which only works on browser and same for server-side environment.
It is good to segregate both the environment to keep dependencies separate. You should check this link to check out things in details.
Upvotes: 2