[PR #315] [MERGED] fix: warn when existing vite.config.ts is missing cloudflare plugin on deploy #473

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

📋 Pull Request Information

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

Base: mainHead: fix/issue-312-deploy-vite-config-prereqs


📝 Commits (2)

  • 921f706 fix: warn when existing vite.config.ts is missing cloudflare plugin on deploy
  • 8ce7ad6 fix: pages router warning shows cloudflare() not cloudflare(())

📊 Changes

3 files changed (+144 additions, -0 deletions)

View changed files

📝 README.md (+24 -0)
📝 packages/vinext/src/deploy.ts (+52 -0)
📝 tests/deploy.test.ts (+68 -0)

📄 Description

Summary

Fixes #312.

Three blockers were reported in the npm create next-appnpx vinext init → deploy flow:

  1. CLOUDFLARE_API_TOKEN permissions not documented
  2. account_id missing from generated wrangler.jsonc, with no docs on how to supply it
  3. Build fails with could not resolve virtual:vinext-rsc-entry because vinext init generates a minimal local-dev vite.config.ts without @cloudflare/vite-plugin, and vinext deploy silently skips config generation when the file already exists

Changes

  • deploy.ts — add viteConfigHasCloudflarePlugin(): when vinext deploy detects an existing vite.config.ts that doesn't import @cloudflare/vite-plugin, it now emits a clear warning with the exact config fix instead of silently proceeding to a broken build
  • README.md — add a "Prerequisites" section to the Cloudflare Workers deployment docs covering: wrangler login vs CLOUDFLARE_API_TOKEN (with correct "Edit Cloudflare Workers" template permissions), and how to supply account_id
  • tests/deploy.test.ts — 7 new unit tests for viteConfigHasCloudflarePlugin()

Testing

pnpm test tests/deploy.test.ts   # 175 tests pass
pnpm test tests/init.test.ts     # 59 tests pass

🔄 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/315 **Author:** [@james-elicx](https://github.com/james-elicx) **Created:** 3/7/2026 **Status:** ✅ Merged **Merged:** 3/7/2026 **Merged by:** [@james-elicx](https://github.com/james-elicx) **Base:** `main` ← **Head:** `fix/issue-312-deploy-vite-config-prereqs` --- ### 📝 Commits (2) - [`921f706`](https://github.com/cloudflare/vinext/commit/921f70622baf57def9b24bd4c93631ca06fcf85e) fix: warn when existing vite.config.ts is missing cloudflare plugin on deploy - [`8ce7ad6`](https://github.com/cloudflare/vinext/commit/8ce7ad673ff4824520a27901c44736aa14cfdc6e) fix: pages router warning shows cloudflare() not cloudflare(()) ### 📊 Changes **3 files changed** (+144 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+24 -0) 📝 `packages/vinext/src/deploy.ts` (+52 -0) 📝 `tests/deploy.test.ts` (+68 -0) </details> ### 📄 Description ## Summary Fixes #312. Three blockers were reported in the `npm create next-app` → `npx vinext init` → deploy flow: 1. `CLOUDFLARE_API_TOKEN` permissions not documented 2. `account_id` missing from generated `wrangler.jsonc`, with no docs on how to supply it 3. Build fails with `could not resolve virtual:vinext-rsc-entry` because `vinext init` generates a minimal local-dev `vite.config.ts` without `@cloudflare/vite-plugin`, and `vinext deploy` silently skips config generation when the file already exists ## Changes - **`deploy.ts`** — add `viteConfigHasCloudflarePlugin()`: when `vinext deploy` detects an existing `vite.config.ts` that doesn't import `@cloudflare/vite-plugin`, it now emits a clear warning with the exact config fix instead of silently proceeding to a broken build - **`README.md`** — add a "Prerequisites" section to the Cloudflare Workers deployment docs covering: `wrangler login` vs `CLOUDFLARE_API_TOKEN` (with correct "Edit Cloudflare Workers" template permissions), and how to supply `account_id` - **`tests/deploy.test.ts`** — 7 new unit tests for `viteConfigHasCloudflarePlugin()` ## Testing ``` pnpm test tests/deploy.test.ts # 175 tests pass pnpm test tests/init.test.ts # 59 tests pass ``` --- <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:16 +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#473
No description provided.