Skip to content

Commit

Permalink
chore(plugin-react): skip code.replace call if no React alias exists
Browse files Browse the repository at this point in the history
  • Loading branch information
aleclarson committed Nov 8, 2021
1 parent fc22244 commit b4b69cf
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/plugin-react/src/jsx-runtime/restore-jsx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ export async function restoreJSX(
filename: string
): Promise<RestoredJSX> {
const [reactAlias, isCommonJS] = parseReactAlias(code)
if (!reactAlias) {
return [null, false]
}

const reactJsxRE = new RegExp(
'\\b' + reactAlias + '\\.(createElement|Fragment)\\b',
'g'
Expand Down

0 comments on commit b4b69cf

Please sign in to comment.