New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix jsxDEV
for generated elements
#12017
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 94720de:
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/28157/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
glad the exec test works!
Is it OK if we cut a patch for this PR? We're planning on releasing React 17 in a couple of weeks which includes the React entrypoints for the new JSX transform changes. Thanks! |
packages/babel-helper-builder-react-jsx-experimental/src/index.js
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am hesitate on throwing an error when loc
is not defined. It is likely that some plugins are not compatible here. But throwing an error in this case blocks compiling JSX. I don't think we should throw here: If we could be tolerant about such issues, the worst outcome is developers don't get correct JSX source locations. It does not worth throwing since the error is not vital.
The plugin currently throws an error when This PR fixes the transform's compatibility with other plugins!
Correct! This PR changes the plugin to not throw an error when source information is missing. You might be referring to the invariant that's present for if the plugin itself improperly uses the |
9fb3f24
to
e166df3
Compare
...l-plugin-transform-react-jsx-development/test/fixtures/cross-platform/generated-jsx/input.js
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
Do you have an ETA of when this will be released? If not today, we can fork this package temporarily. Thank you! |
@Timer I will do a release later today. |
Fixed in |
Great, thanks! |
The new JSX transform does not support generated JSX in development mode, it errors with the following:
This is caused by the
makeSource
function returningundefined
when location information is absent, instead of skipping the property like the old transform.This PR mimics the old behavior and omits the
__source
property when location information is not available. We'll need to check with the React team if this is the desired behavior.cc @lunaruan
x-ref #11154