{"id":"035bc5eb8d062d3d","repo":"gohugoio/hugo","slug":"unsupported-jsx-type-q","errorCode":null,"errorMessage":"unsupported jsx type: %q","messagePattern":"unsupported jsx type: %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/esbuild/options.go","lineNumber":367,"sourceCode":"\tcase \"esm\":\n\t\tformat = api.FormatESModule\n\tcase \"cjs\":\n\t\tformat = api.FormatCommonJS\n\tdefault:\n\t\terr = fmt.Errorf(\"unsupported script output format: %q\", opts.Format)\n\t\treturn\n\t}\n\n\tvar jsx api.JSX\n\tswitch opts.JSX {\n\tcase \"\", \"transform\":\n\t\tjsx = api.JSXTransform\n\tcase \"preserve\":\n\t\tjsx = api.JSXPreserve\n\tcase \"automatic\":\n\t\tjsx = api.JSXAutomatic\n\tdefault:\n\t\terr = fmt.Errorf(\"unsupported jsx type: %q\", opts.JSX)\n\t\treturn\n\t}\n\n\tvar platform api.Platform\n\tswitch opts.Platform {\n\tcase \"\", \"browser\":\n\t\tplatform = api.PlatformBrowser\n\tcase \"node\":\n\t\tplatform = api.PlatformNode\n\tcase \"neutral\":\n\t\tplatform = api.PlatformNeutral\n\tdefault:\n\t\terr = fmt.Errorf(\"unsupported platform type: %q\", opts.Platform)\n\t\treturn\n\t}\n\n\tvar defines map[string]string\n\tif opts.Defines != nil {","sourceCodeStart":349,"sourceCodeEnd":385,"githubUrl":"https://github.com/gohugoio/hugo/blob/8a468df065a75c1c7cf9f6850f32148746590ea5/internal/js/esbuild/options.go#L349-L385","documentation":"Hugo translates the `JSX` option into esbuild's JSX mode. Accepted values are \"\" or \"transform\" (classic React.createElement transform), \"preserve\" (leave JSX untouched), and \"automatic\" (React 17+ automatic runtime). Anything else fails option compilation with this error.","triggerScenarios":"Passing `dict \"JSX\" \"react-jsx\"` (a tsconfig-style value) or any other unrecognized string to js.Build/js.Batch when building .jsx/.tsx files.","commonSituations":"Copying `jsx: \"react-jsx\"` or \"react\" from tsconfig.json instead of using esbuild's terms; typos like \"auto\" instead of \"automatic\"; migrating from a bundler with different JSX mode names.","solutions":["Set JSX to \"transform\", \"preserve\", or \"automatic\" — \"react-jsx\" in tsconfig maps to \"automatic\" here.","If using the automatic runtime, also set `JSXImportSource` (e.g. \"preact\") as needed.","Drop the option to use the default classic transform."],"exampleFix":"{{/* before */}}\n{{ $js := resources.Get \"app.jsx\" | js.Build (dict \"JSX\" \"react-jsx\") }}\n{{/* after */}}\n{{ $js := resources.Get \"app.jsx\" | js.Build (dict \"JSX\" \"automatic\") }}","handlingStrategy":"validation","validationCode":"validJSX := map[string]bool{\"transform\": true, \"preserve\": true, \"automatic\": true}\nif opts.JSX != \"\" && !validJSX[opts.JSX] {\n    return fmt.Errorf(\"invalid jsx option %q; must be transform, preserve, or automatic\", opts.JSX)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use only jsx values esbuild supports: transform, preserve, automatic.","Leave jsx unset unless you actually compile JSX; the default is correct for plain JS/TS.","When using automatic, also set jsxImportSource to avoid a follow-on resolution error."],"tags":["hugo","esbuild","jsx","react","config"],"analyzedSha":"8a468df065a75c1c7cf9f6850f32148746590ea5","analyzedAt":"2026-07-31T21:23:07.045Z","schemaVersion":2}