This PR fixes a bug in support of JSX pragma in Typescript (introduced in https://github.com/babel/babel/pull/9095). We've noticed this bug while building a large codebase with webpack+babel+typescript. Some files from our projects are using `/** @jsx h*/` to use a custom function for JSX syntax; and some others are using the React syntax. We've noticed that our react imports were being removed by babel because the plugin instance was being reused by `babel-loader` and webpack; and it was causing an error : ``` ReferenceError: React is not defined ``` This PR resets the `jsxPragma` being used to the initial value for each new file being processed. I can't add a unit test for this bug because it requires processing 2 files (one with `/** @jsx something */` then one with the react syntax). I've tested a build of this PR and it correctly fixes the issue for us.
@babel/plugin-transform-typescript
Transform TypeScript into ES.next
See our website @babel/plugin-transform-typescript for more information.
Install
Using npm:
npm install --save-dev @babel/plugin-transform-typescript
or using yarn:
yarn add @babel/plugin-transform-typescript --dev