{"id":"5e8d34ecb9aa8624","repo":"gohugoio/hugo","slug":"unsupported-sourcemap-type-q","errorCode":null,"errorMessage":"unsupported sourcemap type: %q","messagePattern":"unsupported sourcemap type: %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/esbuild/options.go","lineNumber":414,"sourceCode":"\tdefault:\n\t\terr = fmt.Errorf(\"unsupported drop type: %q\", opts.Drop)\n\t}\n\n\t// By default we only need to specify outDir and no outFile\n\toutDir := opts.OutDir\n\toutFile := \"\"\n\tvar sourceMap api.SourceMap\n\tswitch opts.SourceMap {\n\tcase \"inline\":\n\t\tsourceMap = api.SourceMapInline\n\tcase \"external\":\n\t\tsourceMap = api.SourceMapExternal\n\tcase \"linked\":\n\t\tsourceMap = api.SourceMapLinked\n\tcase \"\", \"none\":\n\t\tsourceMap = api.SourceMapNone\n\tdefault:\n\t\terr = fmt.Errorf(\"unsupported sourcemap type: %q\", opts.SourceMap)\n\t\treturn\n\t}\n\n\tsourcesContent := api.SourcesContentInclude\n\tif !opts.SourcesContent {\n\t\tsourcesContent = api.SourcesContentExclude\n\t}\n\n\tif opts.IsCSS && opts.MainFields == nil {\n\t\topts.MainFields = []string{\"style\", \"main\"}\n\t}\n\n\topts.Vars = sass.PrepareVars(opts.Vars)\n\n\topts.compiled = api.BuildOptions{\n\t\tOutfile:       outFile,\n\t\tBundle:        true,\n\t\tMetafile:      opts.Metafile,","sourceCodeStart":396,"sourceCodeEnd":432,"githubUrl":"https://github.com/gohugoio/hugo/blob/8a468df065a75c1c7cf9f6850f32148746590ea5/internal/js/esbuild/options.go#L396-L432","documentation":"The `sourceMap` option maps to esbuild's source-map modes. Hugo accepts \"inline\", \"external\", \"linked\", or \"\"/\"none\"; anything else fails option compilation. \"linked\" emits a .map file plus a sourceMappingURL comment, \"external\" emits the .map without the comment, \"inline\" embeds it in the output.","triggerScenarios":"Passing `dict \"sourceMap\" \"true\"`, \"both\", \"hidden\", or other esbuild-CLI-only values to js.Build/js.Batch options.","commonSituations":"Using boolean-ish values (\"true\"/true) expecting webpack-style semantics; using esbuild's \"both\" mode which Hugo doesn't expose; older docs/examples predating the \"linked\" mode (added in newer Hugo versions — on old Hugo, \"linked\" itself triggers this error).","solutions":["Set sourceMap to \"inline\", \"external\", or \"linked\" (usually \"linked\" for dev).","If \"linked\" fails on your Hugo version, upgrade Hugo or use \"external\".","Remove the option or set \"none\" to disable source maps for production."],"exampleFix":"{{/* before */}}\n{{ $js := resources.Get \"main.js\" | js.Build (dict \"sourceMap\" true) }}\n{{/* after */}}\n{{ $js := resources.Get \"main.js\" | js.Build (dict \"sourceMap\" \"linked\") }}","handlingStrategy":"validation","validationCode":"validSourceMap := map[string]bool{\"\": true, \"inline\": true, \"external\": true, \"linked\": true, \"none\": true}\nif !validSourceMap[opts.SourceMap] {\n    return fmt.Errorf(\"invalid sourcemap option %q; must be inline, external, linked, or none\", opts.SourceMap)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use one of the documented sourcemap values: inline, external, linked, or none (empty = disabled).","Note Hugo's accepted set is narrower than esbuild's own CLI values — check Hugo docs, not esbuild docs.","Set sourcemap conditionally per environment in one shared partial to avoid drift."],"tags":["hugo","esbuild","sourcemap","config","debugging"],"analyzedSha":"8a468df065a75c1c7cf9f6850f32148746590ea5","analyzedAt":"2026-07-31T21:23:07.045Z","schemaVersion":2}