Skip to content

Adding swc compilter option to the @nx/react generator using vite #17039

Description

@amitgk1

Description

vite & react generators that allow choosing a compiler/transpiler.
choosing between babel and swc. when choosing babel the react plugin will be the default @vitejs/plugin-react
but when choosing swc, the react plugin will be imported from @vitejs/plugin-react-swc

Motivation

two main reasons:

  1. swc is faster and we want our app to go brrrr
  2. when choosing swc currently as the compiler when generating a react app, together with the vite bundler option, it adds both vite and swc-loader to the packages json even though we aren't using webpack. this elongates our npm i times for nothing.

Suggested Implementation

adding a compiler option to the @nx/vite generator schema and changing the reactPluginImportLine from the generator-utils .ts file according to the user's input.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions