Skip to content

Commit

Permalink
fix(plugin-react): uncompiled JSX in linked pkgs (#5669)
Browse files Browse the repository at this point in the history
  • Loading branch information
aleclarson authored Nov 13, 2021
1 parent 502b8f2 commit 41a7c9c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/plugin-react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,12 @@ export default function viteReact(opts: Options = {}): PluginOption[] {
// By reverse-compiling "React.createElement" calls into JSX,
// React elements provided by dependencies will also use the
// automatic runtime!
const [restoredAst, isCommonJS] = !isProjectFile
? await restoreJSX(babel, code, id)
: [null, false]
const [restoredAst, isCommonJS] =
!isProjectFile && !isJSX
? await restoreJSX(babel, code, id)
: [null, false]

if (isProjectFile || (ast = restoredAst)) {
if (isJSX || (ast = restoredAst)) {
plugins.push([
await loadPlugin(
'@babel/plugin-transform-react-jsx' +
Expand Down

0 comments on commit 41a7c9c

Please sign in to comment.