From 1bd7ef56c478dc4ffe5cc189705656629bc53263 Mon Sep 17 00:00:00 2001 From: Aaron Date: Tue, 20 Feb 2024 13:53:00 -0600 Subject: [PATCH] fix: Don't assume react when importing JSX entrypoints during build (#470) --- src/core/utils/building/import-entrypoint.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/core/utils/building/import-entrypoint.ts b/src/core/utils/building/import-entrypoint.ts index 4a88a074..5ffec7e5 100644 --- a/src/core/utils/building/import-entrypoint.ts +++ b/src/core/utils/building/import-entrypoint.ts @@ -105,6 +105,13 @@ function getEsbuildOptions(opts: JitiTransformOptions): TransformOptions { return { format: 'cjs', loader: isJsx ? 'tsx' : 'ts', - jsx: isJsx ? 'automatic' : undefined, + ...(isJsx + ? { + // `h` and `Fragment` are undefined, but that's OK because JSX is never evaluated while + // grabbing the entrypoint's options. + jsxFactory: 'h', + jsxFragment: 'Fragment', + } + : undefined), }; }