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/ |
|
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! |
JLHwung
left a comment
There was a problem hiding this comment.
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
|
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
makeSourcefunction returningundefinedwhen location information is absent, instead of skipping the property like the old transform.This PR mimics the old behavior and omits the
__sourceproperty 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