PNPM Monorepo on cloudflare pages

hello, i have a pnpm monorepo using lerna, i would like to deploy one of the apps to cloudflare pages from my monorepo heres my build configuration
Build command: pnpm install --force && cd apps/cdn && npx @cloudflare/next-on-pages@1
Build output directory: /apps/cdn/.vercel/output/static
Root directory: /
Build command: pnpm install --force && cd apps/cdn && npx @cloudflare/next-on-pages@1
Build output directory: /apps/cdn/.vercel/output/static
Root directory: /
the issue is that i cannot cd into the correct directory and its running the npx @cloudflare/next-on-pages@1 at root directory and build is failing for the same reason
3 Replies
Oreki
OrekiOP16mo ago
btw if i set the root directory as apps/cdn then it simply would fail since pnpm would not find any workspace to install local workspace deps
James
James16mo ago
Have you tried using a package.json script to run npx @cloudflare/next-on-pages instead. For instance, you could have a script in your app's package.json called pages:build and your build command on Pages could be pnpm run pages:build, or using the correct syntax to run a specific package's scripts.
Oreki
OrekiOP16mo ago
i will try that when i push new commit into github, thanks can't i just use wrangler to deploy .vercel directory? nvm its working now
Want results from more Discord servers?
Add your server