Skip to content

fix: respect jsxImportSource from tsconfig.json in Babel transform#6

Draft
Copilot wants to merge 5 commits intomainfrom
copilot/fix-playwright-bug-from-readme
Draft

fix: respect jsxImportSource from tsconfig.json in Babel transform#6
Copilot wants to merge 5 commits intomainfrom
copilot/fix-playwright-bug-from-readme

Conversation

Copy link

Copilot AI commented Feb 15, 2026

  • Clone and understand the bug from repro repository
  • Identify root cause: Playwright always overrides jsxImportSource to use its own jsx-runtime
  • Modify tsconfig-loader.ts to extract jsx and jsxImportSource from tsconfig
  • Modify babelBundleImpl.ts to respect user's jsxImportSource setting
  • Modify transform pipeline to pass JSX options
  • Verify fix works with repro repository (all 4 tests pass!)
  • Add tests for the fix (4 new tests including renderToStaticMarkup test)
  • Create BUG_DIAGNOSIS.md file
  • Run code review and security checks

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits February 15, 2026 21:28
When users configure jsx: "react-jsx" in their tsconfig.json,
Playwright now correctly uses React's jsx-runtime instead of
forcing its own internal jsx-runtime. This fixes issues where
JSX elements need to be real React elements (e.g., for
renderToStaticMarkup from react-dom/server).

The fix:
1. Extracts jsx and jsxImportSource from tsconfig.json
2. Passes these options through to the Babel transform
3. Uses the user's jsxImportSource when available, defaulting
   to "react" when jsx is "react-jsx" or "react-jsxdev"

Co-authored-by: rwoll <[email protected]>
- Added two tests to verify jsxImportSource from tsconfig is respected
- Created BUG_DIAGNOSIS.md explaining the bug, root cause, and fix

Co-authored-by: rwoll <[email protected]>
Verifies that Playwright's jsx-runtime is still used when no JSX config
is specified in tsconfig.json, maintaining backward compatibility for
Component Testing users.

Co-authored-by: rwoll <[email protected]>
Copilot AI changed the title [WIP] Fix bug in Playwright as described in README.md fix: respect jsxImportSource from tsconfig.json in Babel transform Feb 15, 2026
Copilot AI requested a review from rwoll February 15, 2026 21:35

4. **babelBundle.ts**: Updated the type definitions to support the new JSX options parameter.

## Post-Fix Behavior
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot - can you add a test that explicitly calls renderToStaticMarkup in it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a test in eab0a2b that explicitly calls renderToStaticMarkup from react-dom/server. The test verifies that JSX elements are properly transformed to real React elements when jsx: react-jsx is configured in tsconfig.json, including a nested component test case.

Adds a test that explicitly calls renderToStaticMarkup from react-dom/server
to verify that JSX elements are properly transformed to real React elements
when jsx: react-jsx is configured in tsconfig.json.

Co-authored-by: rwoll <[email protected]>
Copilot AI requested a review from rwoll February 15, 2026 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants