How does turborepo handle node_modules packages?
Hello,
I want to add a new next app to my turborepo monorepo. If I am installing a new package in one of those apps, would I install it in the root directory of the turborepo or within that specific app. Additionally if I am using ct3a, do I need to move the dependencies from package.json into the one at the root directory? Thanks!
Solution:Jump to solution
if Im not mistaken (because I dont use prettier), you can have a root file for prettier and specialize/extend it on each project for their necessities. I believe there are examples online on how to better setup this.
4 Replies
From my experience, turborepo installs dependencies on the root. You can test that and see that it allows you to call a package that is being required only in another context.
Also, avoid moving packages to the root unsless they are required in global context (not because they are present in multiple places), root package.json in monorepos are usually reserved for linters, precommit hooks (dont kill me Theo), and other things that affect everything as a whole.
Got it, I installed them in the app and everything is going well. That would mean though things like prettier and the prettier tailwind plugin belong in the root though right? Thanks!
Solution
if Im not mistaken (because I dont use prettier), you can have a root file for prettier and specialize/extend it on each project for their necessities. I believe there are examples online on how to better setup this.
Awesome, thanks!