Is there a jsx
option missing? Perhaps you meant to refer to jsxPragma
in this preset or the jsx
setting in the tsconfig.json
file?
Also, does @babel/preset-typescript
currently have that capability? I attempted to use Babel to transpile a single file named index.tsx
, which includes elements like <div>...</div>
. Even with all relevant settings applied, nothing seemed to happen to the JSX element <div>...</div>
until I included @babel/preset-react
.
I believe the mentioned option is intended for informing Babel that React imports should not be treated as type imports, rather than removing JSX expressions as outlined in the preset-typescript documentation.
Below is the initial Babel configuration I utilized:
{
"presets": [
"@babel/env",
[
"@babel/preset-typescript",
{
"isTSX": true,
"allExtensions": true,
"jsxPragma": "React",
"jsxPragmaFrag": "React.Fragment"
}
]
]
}