gohugoio/hugo · error
unsupported platform type
Error message
unsupported platform type: %q
What it means
Thrown when Platform is not browser (default), node, or neutral. These are the only platform values esbuild accepts.
Solutions
- Use: browser, node, or neutral.
Example fix
// before
{{ $opts := dict "platform" "web" }}
// after
{{ $opts := dict "platform" "browser" }} Defensive patterns
Strategy: validation
Validate before calling
switch opts.Platform {
case "", "browser", "node", "neutral":
// ok
default:
return fmt.Errorf("unsupported platform type: %q", opts.Platform)
} Prevention
- Validate Platform against {browser, node, neutral} before Build.
- Remember browser is the default; you can usually omit the option.
When it happens
Trigger: Setting Platform to web, deno, or any other string.
Common situations: User assumes web is the platform; tries deno; copy-paste from a bundler that uses different naming.
Related errors
- invalid engine version
- invalid loader
- unsupported drop type
- unsupported jsx type
- unsupported script output format
AI-assisted analysis of gohugoio/hugo@52c9bd7908 (2026-08-09).
Data as JSON: /api/errors/f83215e3f424d7f2.
Report an issue: GitHub.
Appendix: source
Thrown at internal/js/esbuild/options.go:383
case "preserve":
jsx = api.JSXPreserve
case "automatic":
jsx = api.JSXAutomatic
default:
err = fmt.Errorf("unsupported jsx type: %q", opts.JSX)
return
}
var platform api.Platform
switch opts.Platform {
case "", "browser":
platform = api.PlatformBrowser
case "node":
platform = api.PlatformNode
case "neutral":
platform = api.PlatformNeutral
default:
err = fmt.Errorf("unsupported platform type: %q", opts.Platform)
return
}
var defines map[string]string
if opts.Defines != nil {
defines = hmaps.ToStringMapString(opts.Defines)
}
var drop api.Drop
switch opts.Drop {
case "":
case "console":
drop = api.DropConsole
case "debugger":
drop = api.DropDebugger
default:
err = fmt.Errorf("unsupported drop type: %q", opts.Drop)
}View on GitHub (pinned to 52c9bd7908)