24 lines
508 B
JavaScript
24 lines
508 B
JavaScript
import { declare } from "@babel/helper-plugin-utils";
|
|
|
|
export default declare(api => {
|
|
api.assertVersion(7);
|
|
|
|
return {
|
|
name: "syntax-jsx",
|
|
|
|
manipulateOptions(opts, parserOpts) {
|
|
// If the Typescript plugin already ran, it will have decided whether
|
|
// or not this is a TSX file.
|
|
if (
|
|
parserOpts.plugins.some(
|
|
p => (Array.isArray(p) ? p[0] : p) === "typescript",
|
|
)
|
|
) {
|
|
return;
|
|
}
|
|
|
|
parserOpts.plugins.push("jsx");
|
|
},
|
|
};
|
|
});
|