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
TypeScript JSX Fragment removes React import #7979
Comments
Hey @jtmthf! We really appreciate you taking the time to report an issue. The collaborators If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack |
I can confirm, though fortunately this situation is pretty rare. |
#7990 solves this issue. Hopefully |
Humm... It seems to be related to the fact that plugin-transform-typescript checks for type |
Bug Report
Current Behavior
Currently whenever I'm using "@babel/preset-typescript" with JSX fragments and no other JSX, the React import is removed from the compiled output. This only happens with JSX fragments. If you use
React.Fragment
instead, the compiled output is correct. Also worth noting that any other non-fragment jsx in the source will cause the React import to be maintained.Input Code
Expected code
Actual code
Babel Configuration (.babelrc, package.json, cli command)
Environment
Additional context/Screenshots
I have determined this issue to only happen when when "@babel/preset-typescript" is included. Removing any number of other plugins and presets does not fix issue. Additionally I've tried the following variations of the source and they all had the same incorrect output.
The text was updated successfully, but these errors were encountered: