turbo
turbo copied to clipboard
Only rebuild the package that has been changed
Describe the feature you'd like to request
I've like over 15 packages inside my application, and when I run pnpm run dev
turbo goes inside each package and runs the dev
script which starts up multiple process and eventually eating up my PC's RAM and making it slow.
It would be better if Turbo checks for the changed packages and then only run the build
command in the scope of that specific package.
Describe the solution you'd like
I would like to have Turbo to watch for my project's packages and run build
command only in the package that has changed.
Describe alternatives you've considered
I've tired using --parallel
argument via the command line, but it didn't make any difference.
Could you share your turbo.json
or provide a reproduction repo?
Turbo caches the outputs of tasks and only re-execute tasks where the inputs haven't changed, but the behavior you see will depend on what your build
and dev
tasks do.
The common pnpm run dev
story can be tricky though, because dev
is commonly the task that starts a long-running process that writes temporary files (and bust cache) very often.
@mehulkar here is my turbo.json file, i didn't make any changes to it...
{
"$schema": "https://turborepo.org/schema.json",
"pipeline": {
"build": {
"dependsOn": ["^build"],
"outputs": ["dist/**", ".next/**"]
},
"lint": {
"outputs": []
},
"dev": {
"cache": false
}
}
}
I am using tsup
for building (as well as in watch mode), and running pnpm run dev
spawns more than 15 processes of tsup watching for each of the packages...
This sounds to me like you should be using pnpm run dev --filter (thing you're working on)
. In most cases you're not making broad changes across the entire application.
Your alternative proposal can be reduced to turbo run build --watch
, which is an interesting compromise, but requires knowing what items in the graph are leaf nodes vs. root nodes. Those dev
tasks are actually, by rule, all leaf nodes—even if they have things that depend on them!
For now I'd suggest becoming familiar with --filter
and use that to scope down the number of things which are being watched.
@xencodes - if you're still looking into this, there was a really good discussion here on how to use --filter
and --dry-run
to accomplish your goal. Good luck!
@xencodes - if you're still looking into this, there was a really good discussion here on how to use
--filter
and--dry-run
to accomplish your goal. Good luck!
Yeah, thanks