Adds JSXFragment to plugin-transform-typescript check for the presence of jsx (#7996)
This commit is contained in:
committed by
Henry Zhu
parent
0b25e3327c
commit
6d5392554f
@@ -291,6 +291,9 @@ export default declare((api, { jsxPragma = "React" }) => {
|
||||
JSXElement() {
|
||||
sourceFileHasJsx = true;
|
||||
},
|
||||
JSXFragment() {
|
||||
sourceFileHasJsx = true;
|
||||
},
|
||||
});
|
||||
return !sourceFileHasJsx;
|
||||
}
|
||||
|
||||
3
packages/babel-plugin-transform-typescript/test/fixtures/imports/elide-react-no-3/input.mjs
vendored
Normal file
3
packages/babel-plugin-transform-typescript/test/fixtures/imports/elide-react-no-3/input.mjs
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
// Don't elide React if a JSX fragment appears somewhere.
|
||||
import * as React from "react";
|
||||
<></>;
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["syntax-jsx", "transform-typescript"]
|
||||
}
|
||||
3
packages/babel-plugin-transform-typescript/test/fixtures/imports/elide-react-no-3/output.mjs
vendored
Normal file
3
packages/babel-plugin-transform-typescript/test/fixtures/imports/elide-react-no-3/output.mjs
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
// Don't elide React if a JSX fragment appears somewhere.
|
||||
import * as React from "react";
|
||||
<></>;
|
||||
Reference in New Issue
Block a user