From ce975f63d5e3eb22b9ff34cab78ea96cbbd90fd5 Mon Sep 17 00:00:00 2001 From: "${Mr.DJA}" <42304709+iMrDJAi@users.noreply.github.com> Date: Sun, 7 Aug 2022 10:24:22 +0100 Subject: [PATCH 1/3] Allow specifying `throwIfNamespace` option for custom JSX runtimes --- packages/plugin-react/src/index.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/plugin-react/src/index.ts b/packages/plugin-react/src/index.ts index f1adf81510bcef..a9d2e093a5515c 100644 --- a/packages/plugin-react/src/index.ts +++ b/packages/plugin-react/src/index.ts @@ -40,6 +40,11 @@ export interface Options { * @default true */ jsxPure?: boolean + /** + * Toggles whether or not to throw an error if an XML namespaced tag name is used. + * @default true + */ + throwIfNamespace?: boolean; /** * Babel configuration applied in both dev and prod. */ @@ -248,7 +253,8 @@ export default function viteReact(opts: Options = {}): PluginOption[] { { runtime: 'automatic', importSource: opts.jsxImportSource, - pure: opts.jsxPure !== false + pure: opts.jsxPure !== false, + throwIfNamespace: opts.throwIfNamespace } ]) From b475401d4486cc6d737a729957331b57e3839282 Mon Sep 17 00:00:00 2001 From: "${Mr.DJA}" <42304709+iMrDJAi@users.noreply.github.com> Date: Sun, 7 Aug 2022 10:46:16 +0100 Subject: [PATCH 2/3] Forgot an extra semicolon --- packages/plugin-react/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/plugin-react/src/index.ts b/packages/plugin-react/src/index.ts index a9d2e093a5515c..d82a2ce975874d 100644 --- a/packages/plugin-react/src/index.ts +++ b/packages/plugin-react/src/index.ts @@ -44,7 +44,7 @@ export interface Options { * Toggles whether or not to throw an error if an XML namespaced tag name is used. * @default true */ - throwIfNamespace?: boolean; + throwIfNamespace?: boolean /** * Babel configuration applied in both dev and prod. */ From 182b7396233c1d6d2b7171109e229f61fcce7098 Mon Sep 17 00:00:00 2001 From: "${Mr.DJA}" <42304709+iMrDJAi@users.noreply.github.com> Date: Mon, 8 Aug 2022 14:27:36 +0100 Subject: [PATCH 3/3] Added jsx prefix --- packages/plugin-react/src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/plugin-react/src/index.ts b/packages/plugin-react/src/index.ts index d82a2ce975874d..63919b16317509 100644 --- a/packages/plugin-react/src/index.ts +++ b/packages/plugin-react/src/index.ts @@ -44,7 +44,7 @@ export interface Options { * Toggles whether or not to throw an error if an XML namespaced tag name is used. * @default true */ - throwIfNamespace?: boolean + jsxThrowIfNamespace?: boolean /** * Babel configuration applied in both dev and prod. */ @@ -254,7 +254,7 @@ export default function viteReact(opts: Options = {}): PluginOption[] { runtime: 'automatic', importSource: opts.jsxImportSource, pure: opts.jsxPure !== false, - throwIfNamespace: opts.throwIfNamespace + throwIfNamespace: opts.jsxThrowIfNamespace } ])