Skip to content

Commit

Permalink
fix(react): enable vitejs-plugin-react-swc for swc compiler (#27457)
Browse files Browse the repository at this point in the history
## Current Behavior
see #27433

## Expected Behavior
see #27433

## Related Issue(s)
see #27433

Fixes #
- if compiler is `swc`, `@vitejs/plugin-react-swc` is being imported;
otherwise `@vitejs/plugin-react` is being imported

Co-authored-by: Emily Xiong <xiongemi@gmail.com>
(cherry picked from commit 7f2c556)
  • Loading branch information
@NgDaddy authored and FrozenPandaz committed Aug 19, 2024
1 parent 289c1cb commit 0c4857d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/react/src/generators/library/library.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,11 @@ export async function libraryGeneratorInternal(host: Tree, schema: Schema) {
"'react-dom'",
"'react/jsx-runtime'",
],
imports: [`import react from '@vitejs/plugin-react'`],
imports: [
options.compiler === 'swc'
? `import react from '@vitejs/plugin-react-swc'`
: `import react from '@vitejs/plugin-react'`,
],
plugins: ['react()'],
},
true
Expand Down

0 comments on commit 0c4857d

Please sign in to comment.