{"record":{"id":"e3934444a3ca6ec9","repo":"gohugoio/hugo","slug":"unsupported-script-output-format-q","errorCode":null,"errorMessage":"unsupported script output format: %q","messagePattern":"unsupported script output format: %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/esbuild/options.go","lineNumber":357,"sourceCode":"\t\tloader = api.LoaderJSX\n\tcase media.Builtin.CSSType.SubType:\n\t\tloader = api.LoaderCSS\n\tdefault:\n\t\terr = fmt.Errorf(\"unsupported Media Type: %q\", opts.MediaType)\n\t\treturn\n\t}\n\n\tvar format api.Format\n\t// One of: iife, cjs, esm\n\tswitch opts.Format {\n\tcase \"\", \"iife\":\n\t\tformat = api.FormatIIFE\n\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 {","sourceCodeStart":339,"sourceCodeEnd":375,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/internal/js/esbuild/options.go#L339-L375","documentation":"Thrown when Format is not one of iife, esm, or cjs. These are the only output formats esbuild supports and Hugo exposes.","triggerScenarios":"Setting Format to umd, commonjs (wrong shorthand), module, etc.","commonSituations":"User assumes commonjs is the long form of cjs; tries umd or module; copy-paste from Webpack terminology.","solutions":["Use only: iife, esm, or cjs."],"exampleFix":"// before\n{{ $opts := dict \"format\" \"commonjs\" }}\n\n// after\n{{ $opts := dict \"format\" \"cjs\" }}","handlingStrategy":"validation","validationCode":"switch opts.Format {\ncase \"\", \"iife\", \"esm\", \"cjs\":\n    // ok\ndefault:\n    return fmt.Errorf(\"unsupported script output format: %q\", opts.Format)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate Format against {iife, esm, cjs} before Build.","Reject Webpack-style names (umd, commonjs) at config load."],"tags":["esbuild","options","format","validation"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}