For Uppy we recently introduced turbo. However we ran into race conditions with builds. Turbo is smart enough to first build dependencies of a package before building the package itself, however almost all of our packages depend on the peer dependency @uppy/core.
I could not find a way to guarantee @uppy/core is always build first so I added a turbo.json to every package just to add:
{
"extends": ["//"],
"tasks": {
"build": {
"dependsOn": ["@uppy/core#build"]
}
}
}
Now it seems that once dependsOn is added that becomes the single source of truth and turbo no longer builds the dependencies first, or so it seems because we have other race conditions now. Below are logs that kind of prove this as we only set @uppy/core in dependsOn while @uppy/rovider-views is in "dependencies".
@uppy/dropbox:build
cache miss, executing b433e035fd3e1293
Error: src/Dropbox.tsx(1[6](https://github.com/transloadit/uppy/actions/runs/16252201232/job/45883390176#step:11:7),31): error TS2306: File '/home/runner/work/uppy/uppy/packages/@uppy/provider-views/lib/index.d.ts' is not a module.
Error: command finished with error: command (/home/runner/work/uppy/uppy/packages/@uppy/dropbox) /tmp/xfs-ba39c088/yarn run build exited (2)
- More context in our issue Turbo sporadic build race condition · Issue #5822 · transloadit/uppy · GitHub.
- Here is our root turbo.json
What is the best way to solve this?
Order of preference:
- Remove all redundant
turbo.json’s and have a way to make sure@uppy/coreis build first while keeping turbo’s caching features. - Adding
dependsOnshould not ignore dependencies - Manually add all dependencies to every
turbo.json - Something else?