Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSX Transform: React compatibility - Add polyfill to prevent issues on sites running WP 6.5.5 or lower #38424

Closed
Tracked by #37951
coder-karen opened this issue Jul 19, 2024 · 0 comments · Fixed by #38428

Comments

@coder-karen
Copy link
Contributor

Issue

Several packages now use React's automatic runtime to transform JSX in recent package versions: @wordpress/scripts, @wordpress/dependency-extraction-webpack-plugin and possibly @wordpress/babel-preset-default, which can cause issues where these packages are included, on sites running 6.5.5 or lower, that make use of the old JSX transform.

Within the Jetpack monorepo, the main concern is @wordpress/dependency-extraction-webpack-plugin. Should that package have it's version updated in any other package that lists is as a dependency (which is currently being prevented by this snippet:

for ( const [ k, v ] of Object.entries( lockfile.packages ) ) {
), then sites that are not running WordPress 6.6 and that make use of the old JSX transform will see breakages.

Temporary solution

Until we're able to switch to the new JSX transform throughout the monorepo where relevant, we can polyfill the react-jsx-runtime script in a similar manner to what was mentioned here. This will ensure sites with WordPress versions below 6.6 do not encounter issues, if we then update the relevant package.

Parent React compatibility issue: #37951

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants