How to build peer dependencies first? #10695
-
SummaryFor 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 I could not find a way to guarantee {
"extends": ["//"],
"tasks": {
"build": {
"dependsOn": ["@uppy/core#build"]
}
}
}Now it seems that once
What is the best way to solve this? Order of preference:
Additional informationNo response Example |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Hi Murderlon, This is a common challenge with Turbo when you have a peer dependency that many packages rely on, like @uppy/core. Turbo automatically orders builds based on dependencies in package.json, but peerDependencies aren’t considered by default in the task graph. Why your current approach causes issues This can break ordering and cause race conditions because other dependencies might not be built before the package. Recommended approaches Convert peerDependencies to explicit dependencies during build Explicitly list all dependencies in turbo.json Use the dependsOn array carefully This tells Turbo to build dependencies as usual (^build) plus @uppy/core first. Summary
|
Beta Was this translation helpful? Give feedback.
Hi Murderlon,
This is a common challenge with Turbo when you have a peer dependency that many packages rely on, like @uppy/core. Turbo automatically orders builds based on dependencies in package.json, but peerDependencies aren’t considered by default in the task graph.
Why your current approach causes issues
When you add "dependsOn": ["@uppy/core#build"] in your package-specific turbo.json, Turbo treats that as the only dependency for the task, ignoring the implicit ones from package.json.
This can break ordering and cause race conditions because other dependencies might not be built before the package.
Recommended approaches
Centralize dependency info in root turbo.json
Instead of addin…