[PR #358] [MERGED] fix: fail build when cloudflare() plugin is missing #507

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

📋 Pull Request Information

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

Base: mainHead: fix/fail-missing-cloudflare-plugin


📝 Commits (3)

  • 4430290 fix: fail build when cloudflare() plugin is missing
  • b043273 refactor: extract shared utilities for cloudflare plugin guard
  • 9e5685f Update packages/vinext/src/deploy.ts

📊 Changes

3 files changed (+128 additions, -23 deletions)

View changed files

📝 packages/vinext/src/deploy.ts (+45 -23)
📝 packages/vinext/src/index.ts (+18 -0)
📝 tests/deploy.test.ts (+65 -0)

📄 Description

Summary

  • Upgrades the deploy-time console.warn to a hard throw in deploy.ts when the user's vite.config.ts is missing @cloudflare/vite-plugin
  • Adds a build-time validation in the Vite plugin's configResolved hook: if a wrangler config file exists but cloudflare() is not registered, the build fails with an actionable error message
  • Scoped to builds only (not dev), and skipped when Nitro is the deployment target

Previously, forgetting cloudflare() produced a cryptic could not resolve virtual:vinext-rsc-entry error deep in wrangler's esbuild. Now the build fails early with a clear message showing exactly what to add.

Closes #325

Test plan

  • tests/deploy.test.ts passes (182 tests)
  • tests/build-optimization.test.ts passes (60 tests)
  • CI (lint, typecheck, vitest, playwright)

🔄 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/358 **Author:** [@Divkix](https://github.com/Divkix) **Created:** 3/8/2026 **Status:** ✅ Merged **Merged:** 3/8/2026 **Merged by:** [@james-elicx](https://github.com/james-elicx) **Base:** `main` ← **Head:** `fix/fail-missing-cloudflare-plugin` --- ### 📝 Commits (3) - [`4430290`](https://github.com/cloudflare/vinext/commit/4430290c917743521f4a40e30b3e9ee7c4595123) fix: fail build when cloudflare() plugin is missing - [`b043273`](https://github.com/cloudflare/vinext/commit/b04327328e755f20103866cd23a3b69dacb36c0f) refactor: extract shared utilities for cloudflare plugin guard - [`9e5685f`](https://github.com/cloudflare/vinext/commit/9e5685f42458b2618298ed2ce83a4dbfb0150e87) Update packages/vinext/src/deploy.ts ### 📊 Changes **3 files changed** (+128 additions, -23 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/src/deploy.ts` (+45 -23) 📝 `packages/vinext/src/index.ts` (+18 -0) 📝 `tests/deploy.test.ts` (+65 -0) </details> ### 📄 Description ## Summary - Upgrades the deploy-time `console.warn` to a hard `throw` in `deploy.ts` when the user's `vite.config.ts` is missing `@cloudflare/vite-plugin` - Adds a build-time validation in the Vite plugin's `configResolved` hook: if a wrangler config file exists but `cloudflare()` is not registered, the build fails with an actionable error message - Scoped to builds only (not dev), and skipped when Nitro is the deployment target Previously, forgetting `cloudflare()` produced a cryptic `could not resolve virtual:vinext-rsc-entry` error deep in wrangler's esbuild. Now the build fails early with a clear message showing exactly what to add. Closes #325 ## Test plan - [x] `tests/deploy.test.ts` passes (182 tests) - [x] `tests/build-optimization.test.ts` passes (60 tests) - [x] CI (lint, typecheck, vitest, playwright) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 13:08:27 +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#507
No description provided.