Using pnpm With Cloudflare Pages
My blog is running on Cloudflare Pages. After I switched from npm to pnpm recently, the builds on Cloudflare started failing. Some quick Google research revealed that Cloudflare Pages doesn't support pnpm yet, but it turned out that the solution was super simple. As I didn't see this described anywhere, I wanted to quickly document it.
In the Cloudflare dashboard, within the Pages project's settings, the "build command" can be specified. As changing the default `npm run build` to pnpm run build
didn't work (no official pnpm support yet), I changed the command to npm -g install pnpm && pnpm run build
, and it just worked. It's not ideal because now every build needs to globally install pnpm first, but for my blog, which doesn't change all that often, the few additional seconds in build time don't really matter.