#61324 closed enhancement (fixed)
React: Upgrade to the new JSX transform
Reported by: | youknowriad | Owned by: | ellatrix |
---|---|---|---|
Milestone: | 6.6 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Build/Test Tools | Keywords: | gutenberg-merge has-patch |
Focuses: | javascript | Cc: |
Description
The next version of the WordPress packages is going to rely on the JSX transform after this Gutenberg PR https://github.com/WordPress/gutenberg/pull/61692
So this tickets tracks the backport of the webpack config change in that PR in order to be able to load the JSX runtime from the global variable.
Change History (9)
This ticket was mentioned in PR #6678 on WordPress/wordpress-develop by @youknowriad.
6 months ago
#1
- Keywords has-patch added
#2
@
6 months ago
- Owner set to ellatrix
- Resolution set to fixed
- Status changed from new to closed
In 58271:
This ticket was mentioned in PR #7021 on WordPress/wordpress-develop by @youknowriad.
5 months ago
#5
In 6.6 we tried moving away from the deprecated React UMD builds, the issue we faced is that there's a warning that is triggered on the console because we're not using a separate impact for createRoot
. (SCRIPT_DEBUG true and npm run build
)
Warning: You are importing createRoot from "react-dom" which is not supported. You should instead import it from "react-dom/client".
This warning has been removed in React 19 though along with the removal of the UMD builds, so we should be able to revert this PR when we upgrade to React 19.
@Mamaduka commented on PR #7021:
5 months ago
#6
@youknowriad, can you share testing instructions for the core? From our Slack conversation, I remember that some changes were required for wp-env
.
@youknowriad commented on PR #7021:
5 months ago
#7
Yes, so to reproduce the issue on core, you have to use the "build" folder in your environment so
- in
.env
file, you can change theLOCAL_DIR
tobuild
instead ofsrc
- run
npm run build
- run
npm run env:start
to launch the environment
you should be able to see the issue in trunk but not in this PR.
Trac ticket: https://core.trac.wordpress.org/ticket/61324
Backports Gutenberg PR https://github.com/WordPress/gutenberg/pull/61692
This PR adds the necessary webpack config to build the React JSX Runtime script and adds the script to WordPress. Without this, the next package update on Core will be blocked as the new packages are going to be using the new JSX Runtime.
For the moment though, you can test that the PR adds the
react-jsx-runtime
script towp-includes/js/dist/vendor/react-jsx-runtime.js
Also if you load manually the
react-jsx-runtime
in WordPress, you'll see the ReactJSXRuntime global available in the console.