[internal] Use React 18's JSX runtime for v5.x UMD builds#44815
[internal] Use React 18's JSX runtime for v5.x UMD builds#44815DiegoAndai merged 8 commits intomui:v5.xfrom
Conversation
|
@Janpot do you think this approach might have some unwanted side effects? I tried to find a way to add a resolution through the rollup configuration but couldn't find any way to do it. |
fbe1dda to
0535862
Compare
Netlify deploy previewhttps://deploy-preview-44815--material-ui.netlify.app/ Bundle size reportDetails of bundle changes (Toolpad) |
aarongarciah
left a comment
There was a problem hiding this comment.
Looks good. We can update it later if @Janpot proposes a better solution.
|
@aarongarciah I reworked this as @Janpot and I didn't want to commit to the previous approach 😅 I updated the description with the new approach, which is much cleaner. I also attached an |
Janpot
left a comment
There was a problem hiding this comment.
looks great. small suggestion to avoid reaching in the node_modules folder directly
After #44720, we forgot to keep using React 18 for the UMD builds. React 19 removed their UMD builds, so we need to use React 18 for it.
To fix this, this PR:
react18dependency to themui-materialpackage, which is an alias forreact@^18.3.1jsx/runtimeto thereact18dependencyTo make this work, I had to update:
rollup-plugin-commonjs(deprecated) to@rollup/plugin-commonjsrollup-plugin-node-resolve(deprecated) to@rollup/plugin-node-resolveThese are the updated packages that are recommended. Without this update, the fix still works, but with the updated packages, replacing
jsx/runtimeis much, much cleaner.This also means that
namedExportsis no longer required, as this has been fixed in@rollup/plugin-commonjs.I smoke tested with this PR's build and three components:Smoke test: index.html.zip
This PR also fixes the UMD build test.