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

react/jsx-runtime.js is no longer available #2156

Closed
4 tasks done
hahnbeelee opened this issue Oct 19, 2022 · 4 comments
Closed
4 tasks done

react/jsx-runtime.js is no longer available #2156

hahnbeelee opened this issue Oct 19, 2022 · 4 comments
Labels
📚 area/docs This affects documentation 💪 phase/solved Post is done

Comments

@hahnbeelee
Copy link

Initial checklist

Affected packages and versions

https://mdxjs.com/guides/mdx-on-demand/

Link to runnable example

https://github.com/mintlify/mint/blob/a4c4c326901c29adda9788b569df44502cf94d1d/client/src/pages/_sites/%5Bsite%5D/%5B%5B...slug%5D%5D.tsx

Steps to reproduce

  1. cd client
  2. yarn dev

Expected behavior

I expect run & compile to work.

Actual behavior

There are a couple places in the docs that use:

import * as runtime from 'react/jsx-runtime.js'

However, when I try to replicate the code, I get the following error:

Error: Package subpath './jsx-runtime.js' is not defined by "exports" in /path/node_modules/react/package.json

I'm using React v^18.2.0 and I can't downgrade my React version. Is there something else I can provide as the second argument of run to get it to work? I see the run API documentation says I can provide "jsx, jsxs, and Fragment from an automatic JSX runtime as options", but I have no idea what that means. Do I provide a string(e.g. 'jsx')? Do I import something? I upload this as an issue because I think the docs need improvement and if anyone can show me the light, I'd be more than willing to make a PR fixing it as well :)

Runtime

Node v17

Package manager

yarn v1

OS

macOS

Build and bundle tools

Next.js

@wooorm
Copy link
Member

wooorm commented Oct 19, 2022

Hey!

Remove the .js in newer React and it should work!

Feel free to create a PR that removes it (hopefully in all places!). Or adds a note!

@hahnbeelee
Copy link
Author

@wooorm Thank you! Can you shine light on the run API documentation that says:

You can pass jsx, jsxs, and Fragment from an automatic JSX runtime as options.

@hahnbeelee
Copy link
Author

hahnbeelee commented Oct 19, 2022

It seems to be updated in the code! It just hasn't been deployed to mdxjs.com

wooorm added a commit that referenced this issue Oct 20, 2022
@wooorm
Copy link
Member

wooorm commented Oct 20, 2022

Thanks. There was an over eager project used on the website that was needed for React 17 and older and rewrote all /jsx-runtime"s to /jsx-runtime.js".

Can you shine light on the run API documentation that says:

I’m not sure what I can clarify. You must get those values from a runtime and pass them in?

@wooorm wooorm closed this as completed Oct 20, 2022
@wooorm wooorm added 📚 area/docs This affects documentation 💪 phase/solved Post is done labels Oct 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📚 area/docs This affects documentation 💪 phase/solved Post is done
Development

No branches or pull requests

2 participants