question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

React 18 error: "./jsx-runtime.js is not exported from package"

See original GitHub issue
  • mdx-bundler version: ^8.0.1
  • node version: 16.14.2
  • npm version: 8.5

Relevant code or config

  • N/A

What you did:

I upgraded to React 18 from 17.0.2

What happened:

NOTE: Also using Next.js version 12.1.2. When I run “build” after upgrading react from 17.0.2 to 18.0 I get the error below:


./node_modules/mdx-bundler/dist/client.js Module not found: Package path ./jsx-runtime.js is not exported from package /Volumes/T7/Code/blog-next/node_modules/react (see exports field in /Volumes/T7/Code/blog-next/node_modules/react/package.json)

Import trace for requested module: ./node_modules/mdx-bundler/client/index.js ./pages/snippets/[slug].jsx


Reproduction repository:

Problem description:

React 18 seems to introduce a problem with how jsx-runtime is consumed from React. MDX-Bundler pull request #162 may address this issue already. I am not sure.

Suggested solution:

Maybe test React 18 with Pull Request 162? Also see similar issue here: https://github.com/hashicorp/next-mdx-remote/pull/250

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:5
  • Comments:6

github_iconTop GitHub Comments

1reaction
FradSercommented, Apr 2, 2022

#167 LGTM, upgrade to v9.0.0 works.

1reaction
schicklingcommented, Mar 30, 2022

I was facing the same problem with Contentlayer and found a workaround/solution that works for Next.js:

image
Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues - GitHub
I am running react-dnd@15.1.2 and I am getting this error: Module not found: Error: Package path ./jsx-runtime.js is not exported from ...
Read more >
Module not found: Can't resolve 'react/jsx-runtime' | bobbyhadz
To solve the error "Module not found: Error: Can't resolve 'react/jsx-runtime'", make sure to update the react package by opening your terminal in...
Read more >
Error: 'jsxs' is not exported by node_modules/react/jsx-runtime ...
I ended up having to add react/jsx-runtime to external in the rollup.config.js // rollup.config.js import commonjs from ...
Read more >
can't resolve 'react/jsx-runtime' - You.com | The AI Search ...
React docs says that the new jsx transform approach is backwards compatible, though I met such problem after updating to react 17.0.2. Any...
Read more >
React v18.0 – React Blog
The new rendering behavior in React 18 is only enabled in the parts of your app that use new features. The overall upgrade...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found