Module not found: Error: Package path ./jsx-runtime.js is not exported from package react.
See original GitHub issueDescribe the bug
After upgrading to React 18, react-dnd is now breaking. 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 package ../node_modules/react (see exports field in ../node_modules/react/package.json)
I see that this issue is fixed in react-dnd@16
however, I cannot upgrade to this version, as the ESM only support breaks my test runs.
In issue #3423 where people experience the opposite problem (they have upgraded to v16, and are still on react 17) there is posted a suggestion to add a resolve.fallback
to webpack config. I am currently running on create-react-app, and really would not like to eject for such a simple issue.
Related issues #3428
Issue Analytics
- State:
- Created a year ago
- Reactions:22
- Comments:7
Top Results From Across the Web
Module not found: Error: Package path . is not exported from ...
The issue for me ended up being image imports in the js file. I had these mock valus: import Course1 from "../../ui/course-1.png"; ...
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 >module not found: error: package path . is not ... - You.com
The issue in your code is that you are using functions that are never imported from React. To resolve this issue, you need...
Read more >Package exports - webpack
Any other requests will lead to a ModuleNotFound Error. ... When not using the abbreviation, direct file access e. g. package/file.js will not...
Read more >How to Build Your Own Blog with Next.js and MDX
What to do if you get a server error. Error: Package subpath "./jsx-runtime.js" is not defined by "exports" in "path-to-node_modules/ ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For anyone who are using create-react-app and does not want to eject, this solution worked for me:
I used
react-app-rewired
with thisconfig-overrides.js
:I don’t think this is an ideal solution, but if you want to upgrade to React 18, and still be on
react-dnd@15
, I cannot see another solution.I am also getting same error.
project is based on
create-react-app
and these are inpackage.json
.any thoughts?