[PR #711] [MERGED] fix(build): use createBuilder for Pages Router so cloudflare plugin runs #789

Closed
opened 2026-05-06 13:10:06 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/711
Author: @james-elicx
Created: 3/29/2026
Status: Merged
Merged: 3/29/2026
Merged by: @james-elicx

Base: mainHead: james/fix-pages-wrnagler-config


📝 Commits (4)

  • 8284954 fix(build): use createBuilder for Pages Router so cloudflare plugin runs
  • 75065c1 fix environments
  • cb0d60e fix for tests
  • 89f1cae another guard

📊 Changes

4 files changed (+65 additions, -63 deletions)

View changed files

📝 examples/pages-router-cloudflare/package.json (+7 -6)
📝 packages/vinext/src/cli.ts (+9 -46)
📝 packages/vinext/src/deploy.ts (+8 -11)
📝 packages/vinext/src/index.ts (+41 -0)

📄 Description

fixes #710

The Pages Router build path has used two sequential vite.build() calls since the initial release, predating Cloudflare support. When cloudflare() was later added to the example's vite.config.ts, this path was never updated to match.

The problem: cloudflare()'s config() hook injects a multi-environment block and a builder.buildApp override. Neither takes effect in a plain vite.build() call, so writeBundle sees environment name "ssr" or "client" instead of the registered worker environment name, and never writes .wrangler/deploy/config.json.

Fix: switch the Pages Router path to createBuilder + buildApp(), matching the App Router path. cloudflare() now runs its full lifecycle and writes the deploy config itself.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/cloudflare/vinext/pull/711 **Author:** [@james-elicx](https://github.com/james-elicx) **Created:** 3/29/2026 **Status:** ✅ Merged **Merged:** 3/29/2026 **Merged by:** [@james-elicx](https://github.com/james-elicx) **Base:** `main` ← **Head:** `james/fix-pages-wrnagler-config` --- ### 📝 Commits (4) - [`8284954`](https://github.com/cloudflare/vinext/commit/828495419081a5b6972708b37f6ede339bb16d3e) fix(build): use createBuilder for Pages Router so cloudflare plugin runs - [`75065c1`](https://github.com/cloudflare/vinext/commit/75065c1651f402c3cee6b8f2d7322308e3d79624) fix environments - [`cb0d60e`](https://github.com/cloudflare/vinext/commit/cb0d60ea5da9a62a4c481bdae7769dbed0f33169) fix for tests - [`89f1cae`](https://github.com/cloudflare/vinext/commit/89f1caeb48f6885409e095f0762a13b19c2f1301) another guard ### 📊 Changes **4 files changed** (+65 additions, -63 deletions) <details> <summary>View changed files</summary> 📝 `examples/pages-router-cloudflare/package.json` (+7 -6) 📝 `packages/vinext/src/cli.ts` (+9 -46) 📝 `packages/vinext/src/deploy.ts` (+8 -11) 📝 `packages/vinext/src/index.ts` (+41 -0) </details> ### 📄 Description fixes #710 The Pages Router build path has used two sequential `vite.build()` calls since the initial release, predating Cloudflare support. When `cloudflare()` was later added to the example's `vite.config.ts`, this path was never updated to match. The problem: `cloudflare()`'s `config()` hook injects a multi-environment block and a `builder.buildApp` override. Neither takes effect in a plain `vite.build()` call, so `writeBundle` sees environment name `"ssr"` or `"client"` instead of the registered worker environment name, and never writes `.wrangler/deploy/config.json`. Fix: switch the Pages Router path to `createBuilder` + `buildApp()`, matching the App Router path. `cloudflare()` now runs its full lifecycle and writes the deploy config itself. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 13:10:06 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#789
No description provided.