You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our monorepo follows the standard pattern of being split into deployed /apps and bundled /packages. All of the /packages have a build script that produces a /dist output, which are being cached during CI. When those packages are built we mark all dependencies in that package's package.json as externals so they are not bundled in the final output. This way the /dist output for each package is small - essentially just the bundled source - and the /apps have the ultimate responsibility of combining everything, including dependencies, into the final JS bundle.
The problem is when packages depend on each other the dependencies are part of calculation for determining what is cached, even if the output from the task doesn't change. For example, we might have a dependency chain where package A depends on package B, and B depends on package C. If we make a change to the /src of package C we want the a new version of the output to be cached. However, even though C is marked as an external for B (and B as external for A), both A and B end up rebuilding, even though the final output contents remain unchanged.
Is there a way to tell the build script to only depend on changes to the immediate package's /src and nothing else?
Additional information
I've tried setting the build task in the root turbo.json as:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Our monorepo follows the standard pattern of being split into deployed
/appsand bundled/packages. All of the/packageshave abuildscript that produces a/distoutput, which are being cached during CI. When those packages are built we mark all dependencies in that package'spackage.jsonas externals so they are not bundled in the final output. This way the/distoutput for each package is small - essentially just the bundled source - and the/appshave the ultimate responsibility of combining everything, including dependencies, into the final JS bundle.The problem is when packages depend on each other the dependencies are part of calculation for determining what is cached, even if the output from the task doesn't change. For example, we might have a dependency chain where package
Adepends on packageB, andBdepends on packageC. If we make a change to the/srcof packageCwe want the a new version of the output to be cached. However, even thoughCis marked as an external forB(andBas external forA), bothAandBend up rebuilding, even though the final output contents remain unchanged.Is there a way to tell the
buildscript to only depend on changes to the immediate package's/srcand nothing else?Additional information
I've tried setting the
buildtask in the rootturbo.jsonas:However, if I make a change to a dependency down the line it will still rebuild all of the packages up the dependency stream.
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions