pnpm workspace + turbo + vercel: only redeploy works #9642
-
SummaryHey! I turned my typescript project into a monorepo, with pnpm workspaces. It's now a client (next.js app) and an sdk (library). The sdk is a dependency on the client. Then I discovered that to make it deployable in Vercel, I had to use turbo, or else the client would not build the monorepo dependency. I never used it before, it solves a bunch of problems, loving it! Everything was fine on the work branch, and preview deployments were good. Then I merged into main. Additional information* Followed this guide to setup tubo into my monorepo:
https://turbo.build/repo/docs/getting-started/add-to-existing-repository
* Followed this guide to setup turbo in Vercel:
https://vercel.com/docs/monorepos/turborepo
* Not using Remote Caching
* Vercel build command: `turbo run build` Example |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi, welcome to Turborepo! The reason you're seeing this is that the Luckily, the fix is simple: Add a |
Beta Was this translation helpful? Give feedback.
Hi, welcome to Turborepo!
The reason you're seeing this is that the
dist
directory forsdk
is not being cached. Turborepo only knows to cache directories and files that are in theoutputs
key, so a cache hit won't restoredist
given yourturbo.json
.Luckily, the fix is simple: Add a
"dist/**"
member to youroutputs
array, and then the outputs for thesdk
will be cached for the times when you hit cache.