@babel/preset-react
- @babel/plugin-syntax-jsx
@babel/plugin-transform-react-display-nameAnd with the option:
- @babel/plugin-transform-react-jsx-source
.babelrc
Without options:
{
}
Via CLI
babel --presets @babel/preset-react script.js
pragma
string
, defaults to React.createElement
.
Replace the function used when compiling JSX expressions.
string
, defaults to React.Fragment
.
Replace the component used when compiling JSX fragments.
useBuiltIns
, defaults to false
.
Will use the native built-in instead of trying to polyfill behavior for any plugins that require one.
Toggles plugins that aid in development, such as @babel/plugin-transform-react-jsx-self
and .
This is useful when combined with the env option configuration or .
throwIfNamespace
boolean
, defaults to true
.
Toggles whether or not to throw an error if a XML namespaced tag name is used. For example:
<f:image />
Though the JSX spec allows this, it is disabled by default since React's JSX does not currently have support for it.
.babelrc.js
.babelrc
{
"presets": ["@babel/preset-react"],
"env": {
"development": {
"presets": [["@babel/preset-react", { "development": true }]]
}
}