{"id":"c9c66d8977a8d326","repo":"gohugoio/hugo","slug":"unsupported-drop-type-q","errorCode":null,"errorMessage":"unsupported drop type: %q","messagePattern":"unsupported drop type: %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/esbuild/options.go","lineNumber":397,"sourceCode":"\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 {\n\t\tdefines = hmaps.ToStringMapString(opts.Defines)\n\t}\n\n\tvar drop api.Drop\n\tswitch opts.Drop {\n\tcase \"\":\n\tcase \"console\":\n\t\tdrop = api.DropConsole\n\tcase \"debugger\":\n\t\tdrop = api.DropDebugger\n\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","sourceCodeStart":379,"sourceCodeEnd":415,"githubUrl":"https://github.com/gohugoio/hugo/blob/8a468df065a75c1c7cf9f6850f32148746590ea5/internal/js/esbuild/options.go#L379-L415","documentation":"The `drop` option tells esbuild to strip constructs from the output. Hugo supports exactly one of \"console\" (remove console.* calls) or \"debugger\" (remove debugger statements), or empty for none; any other value produces this error. Note esbuild itself allows both simultaneously, but Hugo's option is a single string.","triggerScenarios":"Passing `dict \"drop\" \"console,debugger\"`, \"logs\", or an array to js.Build/js.Batch; any value other than \"\", \"console\", \"debugger\".","commonSituations":"Trying to drop both console and debugger in one option (esbuild CLI style `--drop:console --drop:debugger` doesn't map to Hugo's single-string option); typos like \"consoles\" or \"console.log\".","solutions":["Set drop to exactly \"console\" or \"debugger\".","If you need both dropped, drop \"console\" via this option and rely on minification/manual removal for debugger statements, or open a feature request — Hugo currently accepts only one.","Remove the option if you don't need stripping."],"exampleFix":"{{/* before */}}\n{{ $js := resources.Get \"main.js\" | js.Build (dict \"drop\" \"console,debugger\") }}\n{{/* after */}}\n{{ $js := resources.Get \"main.js\" | js.Build (dict \"drop\" \"console\") }}","handlingStrategy":"validation","validationCode":"validDrop := map[string]bool{\"\": true, \"console\": true, \"debugger\": true}\nif !validDrop[opts.Drop] {\n    return fmt.Errorf(\"invalid drop option %q; must be console or debugger\", opts.Drop)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["drop accepts only console or debugger — it is a single string in Hugo, not a list like raw esbuild.","Gate drop behind a production flag (e.g. hugo.IsProduction) so dev builds keep console output.","Don't copy esbuild JS-API config verbatim; Hugo's option names/shapes differ slightly."],"tags":["hugo","esbuild","drop","minification","config"],"analyzedSha":"8a468df065a75c1c7cf9f6850f32148746590ea5","analyzedAt":"2026-07-31T21:23:07.045Z","schemaVersion":2}