Sharp Edges
As a little follow-up/reality check to my previous post, I’d like to document my frustration with configuring and launching a new Astro site on Cloudflare, which feels ironic. The specific combo I’ve been wrestling with is pnpm v111 and Astro v7 on Cloudflare Workers.
Try this: in an empty directory, run pnpm init to get a basic package.json file, then follow the manual setup in the Astro docs: run pnpm add astro, add a page at src/pages/index.astro, and add dev/build/preview scripts as documented. Now you should be able to run pnpm run build and get some HTML in your /dist folder. Hooray! But now let’s put it on Cloudflare. If you want it connected to your source control, initialize git and push your folder to GitHub or GitLab.2 OK, almost there!
When you connect your new Workers project to your new repo, you’ll briefly feel a sense of hope. Did I really just deploy my new Astro site in three clicks? Ha, no. You’ll go through several failed builds before you get a success. In no particular order, here’s what it actually took:
- Set the
PNPM_VERSIONenvironment variable to 11, because out of the box right now the build system uses v10, and that won’t work - Delete the
packageManagerfield from the defaultpackage.jsonthatpnpm initcreates — it’s invalid and will fail the build - Add
wrangleras a dependency; without it inpackage.json, pnpm won’t build the project at all - Run
pnpm approve-buildsso pnpm is allowed to run the install scripts forworkerdandesbuild - Maybe you do need a
wrangler.jsoncafter all? Or should you runastro add cloudflare? - etc. etc. etc.
The actual steps needed to make the build work took some trial and error, which is frustrating because all indications are that it should be automatic. Make change, push to origin, check build logs for fail, repeat. I don’t envy the engineers tasked with making that work — there’s no doubt a huge backlog of bugs from esoteric combinations of things that don’t behave as they should.
That said, I don’t think it’s unreasonable to expect that in Q3 2026, pnpm, Astro, and Cloudflare should Just Work.
Footnotes
-
According to State of JS 2025, pnpm was the most-used monorepo/package-manager tool among respondents to that question, and v11 was released in April. I’m just saying it’s not an obscure or bleeding edge tool. ↩
-
Of course you’ll need a
.gitignorefile too so you don’t commitnode_modules, the/.astrofolder, or anything else accidentally, but maybe this is too obvious to mention… ↩



