[PR #1005] [CLOSED] fix: use bare specifier imports for shims to fix @vitejs/plugin-rsc compatibility #1018

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

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/1005
Author: @Divkix
Created: 5/1/2026
Status: Closed

Base: mainHead: fix/shim-imports-1001


📝 Commits (2)

  • 0960106 fix: use bare specifier imports for shims to fix @vitejs/plugin-rsc compatibility (#1001)
  • 1a1f718 fix: use bare specifiers for all server imports to fix #1001

📊 Changes

54 files changed (+263 additions, -181 deletions)

View changed files

📝 packages/vinext/package.json (+4 -0)
📝 packages/vinext/src/build/prerender.ts (+2 -2)
📝 packages/vinext/src/client/vinext-next-data.ts (+1 -1)
📝 packages/vinext/src/cloudflare/kv-cache-handler.ts (+5 -2)
📝 packages/vinext/src/config/next-config.ts (+2 -2)
📝 packages/vinext/src/server/api-handler.ts (+6 -2)
📝 packages/vinext/src/server/app-browser-entry.ts (+8 -8)
📝 packages/vinext/src/server/app-browser-state.ts (+3 -3)
📝 packages/vinext/src/server/app-middleware.ts (+6 -6)
📝 packages/vinext/src/server/app-page-boundary-render.ts (+12 -12)
📝 packages/vinext/src/server/app-page-boundary.ts (+2 -2)
📝 packages/vinext/src/server/app-page-cache.ts (+2 -2)
📝 packages/vinext/src/server/app-page-execution.ts (+2 -2)
📝 packages/vinext/src/server/app-page-head.ts (+5 -5)
📝 packages/vinext/src/server/app-page-method.ts (+2 -2)
📝 packages/vinext/src/server/app-page-params.ts (+1 -1)
📝 packages/vinext/src/server/app-page-probe.ts (+1 -1)
📝 packages/vinext/src/server/app-page-render.ts (+7 -7)
📝 packages/vinext/src/server/app-page-request.ts (+1 -1)
📝 packages/vinext/src/server/app-page-response.ts (+1 -1)

...and 34 more files

📄 Description

Fixes #1001

Summary

  • Converted 67 relative imports across 33 files from '../shims/X.js' to 'vinext/shims/X'
  • Added test to prevent regression (tests/shim-imports.test.ts)
  • Built output now uses bare specifiers that @vitejs/plugin-rsc can track correctly

Problem

vinext's internal modules were using relative imports like '../shims/X.js' which broke @vitejs/plugin-rsc's client-in-server-package-proxy. The plugin only tracks bare specifier imports (like 'vinext/shims/X') for its packageSource map.

When relative imports were used, the plugin fell back to generating a proxy module with absolute filesystem paths, which then failed to resolve against the package's exports field.

Test Plan

  • TDD test added: tests/shim-imports.test.ts verifies all internal imports use bare specifiers
  • Build passes and produces correct output with bare specifiers
  • 44 bare specifier imports in 20 built server files

Notes

Type checking has some issues due to mixed resolution (src/ vs dist/) but this doesn't affect the runtime behavior or the build output. The fix correctly addresses the issue described in #1001.


🔄 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/1005 **Author:** [@Divkix](https://github.com/Divkix) **Created:** 5/1/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/shim-imports-1001` --- ### 📝 Commits (2) - [`0960106`](https://github.com/cloudflare/vinext/commit/0960106f268838d8fe0b881e8760429afd390e80) fix: use bare specifier imports for shims to fix @vitejs/plugin-rsc compatibility (#1001) - [`1a1f718`](https://github.com/cloudflare/vinext/commit/1a1f71890eb7a8eaac7ee489b73f82b926c12a5c) fix: use bare specifiers for all server imports to fix #1001 ### 📊 Changes **54 files changed** (+263 additions, -181 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/package.json` (+4 -0) 📝 `packages/vinext/src/build/prerender.ts` (+2 -2) 📝 `packages/vinext/src/client/vinext-next-data.ts` (+1 -1) 📝 `packages/vinext/src/cloudflare/kv-cache-handler.ts` (+5 -2) 📝 `packages/vinext/src/config/next-config.ts` (+2 -2) 📝 `packages/vinext/src/server/api-handler.ts` (+6 -2) 📝 `packages/vinext/src/server/app-browser-entry.ts` (+8 -8) 📝 `packages/vinext/src/server/app-browser-state.ts` (+3 -3) 📝 `packages/vinext/src/server/app-middleware.ts` (+6 -6) 📝 `packages/vinext/src/server/app-page-boundary-render.ts` (+12 -12) 📝 `packages/vinext/src/server/app-page-boundary.ts` (+2 -2) 📝 `packages/vinext/src/server/app-page-cache.ts` (+2 -2) 📝 `packages/vinext/src/server/app-page-execution.ts` (+2 -2) 📝 `packages/vinext/src/server/app-page-head.ts` (+5 -5) 📝 `packages/vinext/src/server/app-page-method.ts` (+2 -2) 📝 `packages/vinext/src/server/app-page-params.ts` (+1 -1) 📝 `packages/vinext/src/server/app-page-probe.ts` (+1 -1) 📝 `packages/vinext/src/server/app-page-render.ts` (+7 -7) 📝 `packages/vinext/src/server/app-page-request.ts` (+1 -1) 📝 `packages/vinext/src/server/app-page-response.ts` (+1 -1) _...and 34 more files_ </details> ### 📄 Description Fixes #1001 ## Summary - Converted 67 relative imports across 33 files from '../shims/X.js' to 'vinext/shims/X' - Added test to prevent regression (tests/shim-imports.test.ts) - Built output now uses bare specifiers that @vitejs/plugin-rsc can track correctly ## Problem vinext's internal modules were using relative imports like '../shims/X.js' which broke @vitejs/plugin-rsc's client-in-server-package-proxy. The plugin only tracks bare specifier imports (like 'vinext/shims/X') for its packageSource map. When relative imports were used, the plugin fell back to generating a proxy module with absolute filesystem paths, which then failed to resolve against the package's exports field. ## Test Plan - TDD test added: tests/shim-imports.test.ts verifies all internal imports use bare specifiers - Build passes and produces correct output with bare specifiers - 44 bare specifier imports in 20 built server files ## Notes Type checking has some issues due to mixed resolution (src/ vs dist/) but this doesn't affect the runtime behavior or the build output. The fix correctly addresses the issue described in #1001. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 13:11:35 +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#1018
No description provided.