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

Module not found: Error: Can't resolve 'react/jsx-runtime' #6597

Closed
sometinaintright opened this issue Sep 5, 2024 · 5 comments
Closed

Module not found: Error: Can't resolve 'react/jsx-runtime' #6597

sometinaintright opened this issue Sep 5, 2024 · 5 comments

Comments

@sometinaintright
Copy link

sometinaintright commented Sep 5, 2024

Description

Hello, has anyone faced this issue?
The consumer is using classic jsx transform, everything works fine before i introduce lexical and I got this error.

 ERROR in ../../.yarn/__virtual__/@lexical-react-virtual-c8219025cc/0/cache/@lexical-react-npm-0.17.1-cdb2a1288c-5ecb24cecf.zip/node_modules/@lexical/react/LexicalComposer.dev.mjs 12:0-40
Module not found: Error: Can't resolve 'react/jsx-runtime' in 'myworkspace/.yarn/__virtual__/@lexical-react-virtual-c8219025cc/0/cache/@lexical-react-npm-0.17.1-cdb2a1288c-5ecb24cecf.zip/node_modules/@lexical/react'
.....

Per as facebook/react#20235, Don't we support react v17 or could this be an issue of incompatibility with the classic jsx transform?

Version

Lexical version: 0.17.1
React: v17.0.2
Webpack5

@etrepum
Copy link
Collaborator

etrepum commented Sep 5, 2024

React 17 is "supported" but only React 18 and 19 are tested so there are no guarantees for older versions.

facebook/react#20235 (comment) seems relevant to your problem

@sometinaintright
Copy link
Author

sometinaintright commented Sep 6, 2024

React 17 is "supported" but only React 18 and 19 are tested so there are no guarantees for older versions.

facebook/react#20235 (comment) seems relevant to your problem

Thank you! But this may not the solution what i need.

It looks like there no jsx-runtime.js file only index.js in node_modules/react directory, maybe i need add some rule to handle this.

@HJZzzzz
Copy link

HJZzzzz commented Sep 17, 2024

@sometinaintright hi, is ur issue resolved?

@micaelbergeron
Copy link

For posterity, I've ended up reverting the changes to use the classic jsx transformer in @babel/preset-react, as this change breaks compatibility with React <= 17.0 and maybe should have tagged as a major version.

https://github.com/muralco/lexical/tree/build/classic-jsx

@sometinaintright
Copy link
Author

@sometinaintright hi, is ur issue resolved?

Yes, it's been resolved.

Here my root cause:
My project originally used jsx, and I checked the configuration of Webpack, then I found that there was a bit of an issue with handling the path for the React package.

This caused it to analyze 'react/jsx-runtime' and resolve it to 'react/index.js/jsx-runtime.js'.

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

No branches or pull requests

4 participants