-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Compiling error with NextJS 11.1.0: Did you mean to import react/jsx-runtime.js #2568
Comments
Thank you for the hint. Unfortunately it didn't work for me at all. |
What does your config look like? return {
resolve: {
...config.resolve,
alias: {
...config.resolve.alias,
'react/jsx-runtime': require.resolve('react/jsx-runtime')
}
}
} https://nextjs.org/docs/api-reference/next.config.js/custom-webpack-config |
Running into the same problem here. module.exports = {
webpack5: true,
webpack: (config) => {
// Unset client-side javascript that only works server-side
config.resolve.fallback = { fs: false, module: false }
config.resolve.alias['react/jsx-runtime'] = require.resolve('react/jsx-runtime')
config.resolve.alias['react/jsx-dev-runtime'] = require.resolve('react/jsx-dev-runtime')
return config
},
reactStrictMode: true,
i18n: {
locales: ['de-DE'],
defaultLocale: 'de-DE',
},
} |
Can you try replacing require.resolve('react/jsx-runtime') with path.resolve('./node_modules/react/jsx-runtime.js') This is what we use internally with webpack 5. |
Just tried your recommendation, but no avail. both
The only thing of note I can add, is that the |
Does the |
I checked just now and yes, it does. |
Might not be an issue with webpack then, might be node failing to import as it respects its esm import semantics. Best bet would be to have it fixed upstream in React. Try bugging the React devs on GitHub/Twitter. It's just a matter of adding the See also vercel/next.js#27977 |
Seems to definitely be the solution. I just tried by applying a I'll try and bug them upstream then. Thanks for the help so far. |
I was able to update React to 18 Alpha and the error is gone! |
@sauloquirino what's the version of the package? Answer: reactwg/react-18#9 |
Latest of everything as of today (sorry, not in front of my computer right now) |
It's working! Thanks! :) npm install react@alpha react-dom@alpha |
Adding webpack aliases did not help. Upgrade to react 18 beta works for me I have nextjs 11.1.0 and use MUI 5 - it seems nothing is broken after upgrade to react 18. upd: I had to downgrade back to react 17 |
|
For those who can't upgrade to react18 yet, this is the only solution that worked for me with NextJS 12.1: vercel/next.js#27977 (comment) If you click through to the original issue, the library author of react-timezone-select claims they fixed it by exporting "a correct esm + cjs version". |
What version of React Data Grid are you using?
^7.0.0-beta.2
What version of Next.js are you using?
11.1.0
What version of Node.js are you using?
16.6.2
What browser are you using?
Chrome
What operating system are you using?
Windows 10
How are you deploying your application?
local
Describe the Bug
After upgrading the Next to 11.1.0 isn't more possible to run my application. I'm receiving the error below:
Expected Behavior
Expect to works as before, with no errors in the compiling.
To Reproduce
Create a small project nextjs project (11.1.0) using the react-data-grid in the ^7.0.0-beta.2. link and next run npm run dev or yarn run dev;
The text was updated successfully, but these errors were encountered: