Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(plugin-react): adding jsxPure option #7088

Merged
merged 2 commits into from
Mar 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion packages/plugin-react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ export interface Options {
* @default "react"
*/
jsxImportSource?: string
/**
* Set this to `true` to annotate the JSX factory with `\/* @__PURE__ *\/`.
* This option is ignored when `jsxRuntime` is not `"automatic"`.
* @default true
*/
jsxPure?: boolean

/**
* Babel configuration applied in both dev and prod.
Expand Down Expand Up @@ -195,7 +201,8 @@ export default function viteReact(opts: Options = {}): PluginOption[] {
),
{
runtime: 'automatic',
importSource: opts.jsxImportSource
importSource: opts.jsxImportSource,
pure: opts.jsxPure !== false
}
])

Expand Down