fix: respect jsxImportSource from tsconfig.json in Babel transform#6
Draft
fix: respect jsxImportSource from tsconfig.json in Babel transform#6
Conversation
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
rwoll
reviewed
Feb 15, 2026
|
|
||
| 4. **babelBundle.ts**: Updated the type definitions to support the new JSX options parameter. | ||
|
|
||
| ## Post-Fix Behavior |
Owner
There was a problem hiding this comment.
@copilot - can you add a test that explicitly calls renderToStaticMarkup in it?
Author
There was a problem hiding this comment.
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
jsxImportSourceto use its own jsx-runtimetsconfig-loader.tsto extractjsxandjsxImportSourcefrom tsconfigbabelBundleImpl.tsto respect user'sjsxImportSourcesetting💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.