react 单测 Add babelplugin-transform-react-jsx httpsgitiovb4yd to the plugins section of your Babel config to enable transformation
To enable transformation for React JSX in your Babel configuration, you need to add the @babel/plugin-transform-react-jsx plugin to the 'plugins' section.
Here are the steps to do it:
-
Install the plugin as a development dependency using npm or yarn:
npm install --save-dev @babel/plugin-transform-react-jsx -
Open your Babel configuration file (usually named
.babelrcorbabel.config.js). -
Locate the 'plugins' section and add the plugin to the array:
{ "plugins": [ "@babel/plugin-transform-react-jsx" ] } -
Save the changes to your Babel configuration file.
Now, Babel will transform React JSX syntax during the compilation process, allowing you to write and test React components using JSX in your tests
原文地址: https://www.cveoy.top/t/topic/hLw9 著作权归作者所有。请勿转载和采集!