[PR #136] [CLOSED] fix(shims): harden jsx-runtime compatibility across remaining shim modules #343

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

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/136
Author: @liuxiaopai-ai
Created: 2/26/2026
Status: Closed

Base: mainHead: fix/issue-135-shim-jsx-runtime


📝 Commits (1)

  • 609ac24 fix(shims): harden jsx-runtime compatibility across shim modules

📊 Changes

7 files changed (+85 additions, -1 deletions)

View changed files

📝 packages/vinext/src/shims/document.tsx (+4 -0)
📝 packages/vinext/src/shims/form.tsx (+5 -1)
📝 packages/vinext/src/shims/image.tsx (+4 -0)
📝 packages/vinext/src/shims/legacy-image.tsx (+4 -0)
📝 packages/vinext/src/shims/link.tsx (+4 -0)
📝 packages/vinext/src/shims/metadata.tsx (+4 -0)
tests/jsx-runtime-compat.test.ts (+60 -0)

📄 Description

Summary

Follow-up to #45 / #135: harden JSX-runtime compatibility for remaining shim .tsx modules that could still depend on named exports from react/jsx-runtime.

What changed

  • Switched these shims to classic JSX runtime via per-file pragmas:
    • packages/vinext/src/shims/link.tsx
    • packages/vinext/src/shims/metadata.tsx
    • packages/vinext/src/shims/legacy-image.tsx
    • packages/vinext/src/shims/form.tsx
    • packages/vinext/src/shims/document.tsx
    • packages/vinext/src/shims/image.tsx
  • Added missing React default import in next/form shim (required for classic JSX transform).
  • Added regression test tests/jsx-runtime-compat.test.ts that verifies these shim modules load when react/jsx-runtime and react/jsx-dev-runtime only expose default exports.

Why

This closes the gap called out in review on #45: even if error-boundary.tsx is fixed, other shim modules could still fail under packaging setups where react/jsx-runtime named exports are not available.

Closes #135

Validation

  • pnpm -s test tests/jsx-runtime-compat.test.ts tests/link.test.ts tests/form.test.ts tests/image-component.test.ts tests/metadata-routes.test.ts tests/shims.test.ts

🔄 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/136 **Author:** [@liuxiaopai-ai](https://github.com/liuxiaopai-ai) **Created:** 2/26/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/issue-135-shim-jsx-runtime` --- ### 📝 Commits (1) - [`609ac24`](https://github.com/cloudflare/vinext/commit/609ac2461da3c153b67a853d215ab5fb1e3a418d) fix(shims): harden jsx-runtime compatibility across shim modules ### 📊 Changes **7 files changed** (+85 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/src/shims/document.tsx` (+4 -0) 📝 `packages/vinext/src/shims/form.tsx` (+5 -1) 📝 `packages/vinext/src/shims/image.tsx` (+4 -0) 📝 `packages/vinext/src/shims/legacy-image.tsx` (+4 -0) 📝 `packages/vinext/src/shims/link.tsx` (+4 -0) 📝 `packages/vinext/src/shims/metadata.tsx` (+4 -0) ➕ `tests/jsx-runtime-compat.test.ts` (+60 -0) </details> ### 📄 Description ## Summary Follow-up to #45 / #135: harden JSX-runtime compatibility for remaining shim `.tsx` modules that could still depend on named exports from `react/jsx-runtime`. ## What changed - Switched these shims to classic JSX runtime via per-file pragmas: - `packages/vinext/src/shims/link.tsx` - `packages/vinext/src/shims/metadata.tsx` - `packages/vinext/src/shims/legacy-image.tsx` - `packages/vinext/src/shims/form.tsx` - `packages/vinext/src/shims/document.tsx` - `packages/vinext/src/shims/image.tsx` - Added missing `React` default import in `next/form` shim (required for classic JSX transform). - Added regression test `tests/jsx-runtime-compat.test.ts` that verifies these shim modules load when `react/jsx-runtime` and `react/jsx-dev-runtime` only expose default exports. ## Why This closes the gap called out in review on #45: even if `error-boundary.tsx` is fixed, other shim modules could still fail under packaging setups where `react/jsx-runtime` named exports are not available. Closes #135 ## Validation - `pnpm -s test tests/jsx-runtime-compat.test.ts tests/link.test.ts tests/form.test.ts tests/image-component.test.ts tests/metadata-routes.test.ts tests/shims.test.ts` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 12:39:19 +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#343
No description provided.