-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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(react): Fix React jsx runtime import for esm #12740
Conversation
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.
nice
It's look like this MR should break compatibility with react@18. But Only react@17 doesn't have |
Fixes #12608
Sucrase injects a
"react/jsx-runtime"
import, however, ESM requires this to end in.js
because the react package doesn't have an exports field.With this PR we rewrite the import to
"react/jsx-runtime.js"
for our ESM output.I tried importing running
require.resolve("react/jsx-runtime.js")
with node and it crashed so we likely shouldn't do it for CJS.