Externalize react-dom/client#77326
Conversation
|
Size Change: -28 B (0%) Total Size: 7.74 MB 📦 View Changed
ℹ️ View Unchanged
|
|
Flaky tests detected in 024d1e7. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/24397358625
|
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |


Updates the externalization code (both webpack and esbuild) to also externalize
react-dom/clientimports to refer to thereact-domscript handle, i.e., thewindow.ReactDOMglobal.This continues the work done in #76825, streamlining the
react-domlibrary and preparing it for React 19 upgrade. In React 18 and older,react-domalways exportedcreateRootandhydrateRootand thereact-dom/clientwas just a trivial re-export handler. In React 19,react-dom/clientis a big standalone library which would be directly bundled insidewp-elementif we didn't do this externalization. Andreact-domis a tiny library of univeral (both server and client) helpers.How to test: verify that:
createRootfromreact-dom" console warnings are still not there, i.e., we're not regressing the fixes from React vendor script: avoid warning on createRoot #76825.wp-elementscript is smaller, because it no longer bundles thereact-dom/clientcode. Intrunkwith React 18 the size difference is small, in React 19 it would be massive (try with Upgrade to React 19 #61521 if you're really curious).