Skip to content

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

@coder-karen

Description

@coder-karen

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions