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

chore!: drop jsxPure #129

Merged
merged 2 commits into from
Mar 30, 2023
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
13 changes: 5 additions & 8 deletions packages/plugin-react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@ 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 @@ -128,15 +122,13 @@ export default function viteReact(opts: Options = {}): PluginOption[] {
},
jsx: 'transform',
jsxImportSource: opts.jsxImportSource,
jsxSideEffects: opts.jsxPure === false,
},
}
} else {
return {
esbuild: {
jsx: 'automatic',
jsxImportSource: opts.jsxImportSource,
jsxSideEffects: opts.jsxPure === false,
},
}
}
Expand All @@ -157,6 +149,11 @@ export default function viteReact(opts: Options = {}): PluginOption[] {
'[@vitejs/plugin-react] Support for classic runtime is deprecated.',
)
}
if ('jsxPure' in opts) {
config.logger.warnOnce(
'[@vitejs/plugin-react] jsxPure was removed. You can configure esbuild.jsxSideEffects directly.',
)
}

runPluginOverrides = (babelOptions, context) => {
const hooks = config.plugins
Expand Down