Description
Description
When I use the latest version of @wordpress/scripts, I receive a runtime error when trying to use React MUI. However, previous versions of @wordpress/scripts work just fine without causing a runtime error.
The details about the error and how to produce it are listed in the Step-by-step reproduction instructions section.
IMPORTANT NOTE:
After further testing, I noticed that the error appears when I install any @wordpress/scripts that is version 28 (i.e., at the time of writing this bug, versions 28.0.0, 28.0.1, 28.0.2, 28.1.0, 28.2.0, 28.3.0, 28.4.0, and 28.5.0 did not work).
However, there is no run time error and the script runs without any problem, when installing either of the following versions: 26.12.0 and 27.9.0 (I only tested those versions).
Step-by-step reproduction instructions
-
Install WordPress
-
Install @wordpress/scripts
-
Install react-mui accoring to thie instrauctions here https://mui.com/material-ui/getting-started/installation/ (note I only installed the default installation and Roboto font
npm install @mui/material @emotion/react @emotion/styled
npm install @fontsource/roboto
-
Create a component as follows:
import React from 'react'
import { Typography } from '@mui/material'
const MyComponent = () => {
return (
<div>
<Typography>Hi</Typography>
</div>
)
}
export default MyComponent
- Run the code above, and I receive the following error:
TypeError: Cannot read properties of undefined (reading 'jsx')
Screenshots, screen recording, code snippet
This is the error I receive:
Environment info
- WordPress Version 6.6,1
- OS: Linux 6.5 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
- Browsers: Chrome and Firefox
Please confirm that you have searched existing issues in the repo.
- Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
- Yes