Open eps1lon opened 5 months ago
It's not an optimization but a bug fix. mdx-bundler currently bundles the jsx-runtime which isn't supported (it's like bundling React itself). This worked because all supported versions of React were compatible with the bundled JSX runtime. However, React 19 is not compatible with the bundled JSX runtime.
Publishing a new version with an updated version of React 19 will not fix the issue since that would make mdx-bundler incompatible with React <19. By externalizing the JSX runtime, you're compatible with any React version.
It's not a breaking change if you use this library as documented i.e. use mdx-bundler/client
. It is breaking if you inlined mdx-bundler/client
since you'd now need to update it.
Hmmm.... Looks like this is failing the tests 🤔
I'll take a look later
What:
Fixes compatibility with React 19. We're using mdx-bundler in vercel.com, https://nextjs.org/ and various other Vercel surfaces. We're using this patch in production already. Otherwise we couldn't use React 19.
Why:
Bundling the JSX runtime always worked incidentally even though it was never officially supported. Due to changes to the React secret internals, we now enforce not bundling parts of React while externalizing others. Either you bundle everything or none.
How:
Externalize all React entrypoints
Checklist: