Skip to content
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: Can't resolve 'react/jsx-runtime.js' #250

Merged
merged 1 commit into from
Mar 25, 2022

Conversation

jakejarvis
Copy link
Contributor

Simply changes the import of react/jsx-runtime.js to react/jsx-runtime. This was causing errors when using Preact and React 18 — shouldn't affect anything else as far as I know! :)

fixes #237

@hashicorp-cla
Copy link

hashicorp-cla commented Mar 16, 2022

CLA assistant check
All committers have signed the CLA.

@jakejarvis jakejarvis force-pushed the fix-react-jsx-runtime branch from 4981384 to 913c7d6 Compare March 16, 2022 02:41
Copy link
Contributor

@BRKalow BRKalow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@BRKalow BRKalow merged commit 28d667f into hashicorp:main Mar 25, 2022
@jakejarvis
Copy link
Contributor Author

jakejarvis commented Mar 25, 2022

@BRKalow This still works locally for me but Vercel is now refusing to build, giving the opposite error Did you mean to import react/jsx-runtime.js?...

Trying to figure this out and test different things on the Vercel side (maybe something with node v14?) but if you want to revert this for now that might be wise... very sorry about that and to anyone else having problems! :)


Possibly related, if anyone has any ideas:

BRKalow pushed a commit that referenced this pull request Mar 25, 2022
@BRKalow
Copy link
Contributor

BRKalow commented Mar 25, 2022

@jakejarvis No worries! I reverted for now and published another release so folks won't get breakage over the weekend. Feel free to open another PR if you do figure something out! 🙏

@jakejarvis
Copy link
Contributor Author

Looks like this is the answer to fix React 18 — react/jsx-runtime is officially exported from React's package.json now. But, this breaks React 17 which doesn't export it and requires the .js. So we need to account for both somehow... 🤦

@switz
Copy link

switz commented Mar 30, 2022

Worthwhile to deploy a new major version that pins it at React >= 18?

@jakejarvis
Copy link
Contributor Author

@switz that's the most logical solution I can think of too, unfortunately

@mryechkin
Copy link

mryechkin commented Apr 2, 2022

For anyone who ended up here like I did, looking for a fix - make sure you're pinning to version 4.0.1 and NOT 4.0.2 for the time being until this is resolved. Running npm i next-mdx-remote@latest will install 4.0.2 where this was reverted

@nikodem-wrona
Copy link

Reverting back to next-mdx-remote@4.0.1 for react@latest worked for me

@BRKalow
Copy link
Contributor

BRKalow commented Apr 4, 2022

Thanks for the insight here, y'all! I'll try to come up with something which works for both v17 and v18 this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Preact: Can't resolve 'react/jsx-runtime.js'
6 participants