Bug: [5.0] Can't resolve 'react/jsx-runtime'
See original GitHub issueDescribe the bug
Importing the package react-data-grid
results int he following error upon yarn start
:
ERROR in ./node_modules/react-data-grid/lib/bundle.js 3:0-56
Module not found: Error: Can't resolve 'react/jsx-runtime' in '/Users/alamothe/Projects/car-manager/fleet-client/node_modules/react-data-grid/lib'
Did you mean 'jsx-runtime.js'?
BREAKING CHANGE: The request 'react/jsx-runtime' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
No error is observed in CRA 4.
Did you try recovering your dependencies?
Yes.
Which terms did you search for in User Guide?
Searched for: Can't resolve 'react/jsx-runtime'
Environment
Environment Info:
current version of create-react-app: 4.0.3
running from /Users/alamothe/.config/yarn/global/node_modules/create-react-app
System:
OS: macOS 11.6.1
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Binaries:
Node: 14.18.2 - /usr/local/opt/node@14/bin/node
Yarn: 3.2.0-rc.7 - /usr/local/bin/yarn
npm: 6.14.15 - /usr/local/opt/node@14/bin/npm
Browsers:
Chrome: 96.0.4664.110
Edge: 96.0.1054.53
Firefox: 94.0.2
Safari: 15.1
npmPackages:
react: ^17.0.2 => 17.0.2
react-dom: ^17.0.2 => 17.0.2
react-scripts: 5.0.0 => 5.0.0
npmGlobalPackages:
create-react-app: 4.0.3
Steps to reproduce
- Import
react-data-grid
Expected behavior
No error, like in 4.0
Issue Analytics
- State:
- Created 2 years ago
- Reactions:18
- Comments:12 (2 by maintainers)
Top Results From Across the Web
got Can't resolve 'react/jsx-runtime' error while use try to create ...
To solve the error "Module not found: Error: Can't resolve 'react/jsx-runtime'", make sure to update the react package by opening your ...
Read more >Cannot find module 'react/jsx-runtime' or its corresponding ...
To solve the error "Cannot find module 'react/jsx-runtime' or its corresponding type declarations", make sure to install the typings for react running the ......
Read more >react-dnd 16.0.0 and DnDProvider.js : r/reactjs - Reddit
BREAKING CHANGE: The request 'react/jsx-runtime' failed to resolve only because it was resolved as fully specified (probably because the origin ...
Read more >Can't resolve 'react/jsx-runtime' in 'C:\Users\qurek\Desktop\tmp ...
I have decided to add Material UI to my old React project (I use pure JavaScript). When I try to run application the...
Read more >cannot find module '@emotion/react/jsx-runtime' or its ...
Nov 18, 2020 ... It means that it doesn't find react/jsx-runtime module as if you would have an older version installed. Please always...
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
@raix I agree with you but a simple entry in Webpack config fixes it (which is equivalent to what React 18 does):
Hi,
I have the same issue when running
npm run build
in a project usinggraphql-js
:Digging a bit in webpack issues led me to this solution.
Hardcoding this rule in CRA v5 webpack.config.js makes the error disappear but I guess there’s no way to edit the config without ejecting?