[PR #3] [MERGED] fix: exclude vinext from optimizeDeps to prevent virtual module resolution errors #236

Closed
opened 2026-05-06 12:38:42 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/3
Author: @threepointone
Created: 2/24/2026
Status: Merged
Merged: 2/24/2026
Merged by: @southpolesteve

Base: mainHead: fix/exclude-vinext-from-optimizedeps


📝 Commits (2)

  • 0c15c4a fix: exclude vinext from optimizeDeps to prevent virtual module resolution errors
  • 2f3c2bf test: verify optimizeDeps.exclude contains vinext for all environments

📊 Changes

2 files changed (+96 additions, -0 deletions)

View changed files

📝 packages/vinext/src/index.ts (+9 -0)
📝 tests/build-optimization.test.ts (+87 -0)

📄 Description

Problem

When vinext is installed from npm (not symlinked), vite dev fails with:

✘ [ERROR] Could not resolve "virtual:vinext-rsc-entry"

esbuild's dependency optimization scans vinext/dist/ and hits virtual:vinext-* imports that only exist at Vite plugin resolution time. This occurs in all three environments (client, rsc, ssr).

Fix

Adds optimizeDeps.exclude: ["vinext"] at the top level and in each environment config (rsc, ssr, client). This prevents esbuild from scanning vinext's dist files during pre-bundling.

Uses the stable optimizeDeps.exclude API rather than an esbuild plugin, so it won't break in future Vite majors.

Fixes #1


🔄 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/3 **Author:** [@threepointone](https://github.com/threepointone) **Created:** 2/24/2026 **Status:** ✅ Merged **Merged:** 2/24/2026 **Merged by:** [@southpolesteve](https://github.com/southpolesteve) **Base:** `main` ← **Head:** `fix/exclude-vinext-from-optimizedeps` --- ### 📝 Commits (2) - [`0c15c4a`](https://github.com/cloudflare/vinext/commit/0c15c4a82c7742499f21e5ba87dfa5c5e8444e8e) fix: exclude vinext from optimizeDeps to prevent virtual module resolution errors - [`2f3c2bf`](https://github.com/cloudflare/vinext/commit/2f3c2bf179c0ee12ba9ea57ab262d86eb6311a39) test: verify optimizeDeps.exclude contains vinext for all environments ### 📊 Changes **2 files changed** (+96 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/src/index.ts` (+9 -0) 📝 `tests/build-optimization.test.ts` (+87 -0) </details> ### 📄 Description ## Problem When vinext is installed from npm (not symlinked), `vite dev` fails with: ``` ✘ [ERROR] Could not resolve "virtual:vinext-rsc-entry" ``` esbuild's dependency optimization scans `vinext/dist/` and hits `virtual:vinext-*` imports that only exist at Vite plugin resolution time. This occurs in all three environments (client, rsc, ssr). ## Fix Adds `optimizeDeps.exclude: ["vinext"]` at the top level and in each environment config (rsc, ssr, client). This prevents esbuild from scanning vinext's dist files during pre-bundling. Uses the stable `optimizeDeps.exclude` API rather than an esbuild plugin, so it won't break in future Vite majors. Fixes #1 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 12:38:42 +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#236
No description provided.