Open natew opened 2 years ago
There's a workaround by aliasing react/jsx-runtime.js
to preact/jsx-runtime
in next.config.js
.
You can find an example here https://github.com/kentcdodds/mdx-bundler/issues/140#issuecomment-1013928307 on a similar issue I opened recently.
After a few tries for whatever reason the alias works now:
const jsxRuntime = require.resolve('react/jsx-runtime.js')
webpackConfig.resolve.alias = {
'react/jsx-runtime.js': jsxRuntime,
'react/jsx-runtime': jsxRuntime,
}
Happy to submit a PR for this, affects versions 7-8 at least, node 14+. You can see it when running
yarn site
inWhat you did:
Set up next.js + mdx-bundler.
What happened:
Reproduction repository:
https://github.com/tamagui/tamagui
Problem description:
Importing the
.js
fully specified seems to mess up webpack. I must be using some version that is weird somewhere - whether React or Webpack..Suggested solution:
I think just changing the import from
react/jsx-runtime.js
toreact/jsx-runtime
would make this a bit more compatible, happy to submit a PR.