{"id":"3967f9ff58938844","repo":"gohugoio/hugo","slug":"esbuild-entry-point-output-not-found","errorCode":null,"errorMessage":"esbuild: entry point output not found","messagePattern":"esbuild: entry point output not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"resources/resource_transformers/js/build.go","lineNumber":110,"sourceCode":"\t\tbasePath := path.Base(filepath.ToSlash(file.Path))\n\t\tif strings.HasSuffix(basePath, \".map\") {\n\t\t\tif hasSourceMap {\n\t\t\t\tif err = transformCtx.PublishSourceMap(file.Contents); err != nil {\n\t\t\t\t\treturn result, err\n\t\t\t\t}\n\t\t\t}\n\t\t} else if isStdinEntryOutput(basePath) {\n\t\t\tmainOutput = file.Contents\n\t\t} else {\n\t\t\t// File-loader artifact; publish directly.\n\t\t\tif err = publishFileLoaderArtifact(pathSpec, opts.PublicPath, outDir, basePath, file.Contents, transformCtx); err != nil {\n\t\t\t\treturn result, err\n\t\t\t}\n\t\t}\n\t}\n\n\tif mainOutput == nil {\n\t\treturn result, fmt.Errorf(\"esbuild: entry point output not found\")\n\t}\n\n\tif hasLinkedSourceMap {\n\t\tsymPath := path.Base(transformCtx.OutPath) + \".map\"\n\t\tif opts.IsCSS {\n\t\t\tre := regexp.MustCompile(`/\\*# sourceMappingURL=.*\\n?`)\n\t\t\tmainOutput = re.ReplaceAll(mainOutput, []byte(\"/*# sourceMappingURL=\"+symPath+\" */\\n\"))\n\t\t} else {\n\t\t\tre := regexp.MustCompile(`//# sourceMappingURL=.*\\n?`)\n\t\t\tmainOutput = re.ReplaceAll(mainOutput, []byte(\"//# sourceMappingURL=\"+symPath+\"\\n\"))\n\t\t}\n\t}\n\n\tif _, err = transformCtx.To.Write(mainOutput); err != nil {\n\t\treturn result, err\n\t}\n\n\treturn result, nil","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/gohugoio/hugo/blob/8a468df065a75c1c7cf9f6850f32148746590ea5/resources/resource_transformers/js/build.go#L92-L128","documentation":"After running esbuild, Hugo walks the output files, publishing source maps and file-loader artifacts and capturing the main bundle (the stdin entry point output). If no output file matches the expected stdin entry name, mainOutput stays nil and Hugo reports that esbuild produced no entry-point output. This is a guard against silently publishing an empty bundle and usually indicates esbuild produced nothing or only artifacts.","triggerScenarios":"js.Build/js.Batch runs where esbuild's OutputFiles contain no file recognized by isStdinEntryOutput — e.g. every output is a .map or a file-loader asset, or an esbuild option combination (unusual entryNames/splitting/plugin behavior) renamed the entry output so it no longer matches the stdin entry naming.","commonSituations":"Custom esbuild params (via the params/defines/plugins options) that alter output naming; edge cases after Hugo or esbuild version upgrades changing output naming conventions; sourceMap-only outputs when the entry compiles to nothing.","solutions":["Simplify the js.Build options to defaults and re-add options one at a time to find the one breaking entry output naming.","Verify the entry script actually produces output (not an empty file / all-side-effect-free tree-shaken module).","Upgrade Hugo — entry-output detection has changed across versions; a mismatch can be a fixed bug.","Run hugo with --logLevel debug to see the transform inputs, and report a minimal reproduction if it persists."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"{{ $entry := resources.Get \"js/main.js\" }}\n{{ if not $entry }}{{ errorf \"missing js entry point assets/js/main.js\" }}{{ end }}\n{{ $built := $entry | js.Build (dict \"target\" \"es2018\") }}","typeGuard":null,"tryCatchPattern":"{{ with try (js.Build $entry $opts) }}{{ with .Err }}{{ errorf \"js.Build failed: %s\" . }}{{ end }}{{ end }}","preventionTips":["Verify the entry file exists in assets/ and has a supported extension (.js/.ts/.jsx/.tsx)","Check esbuild `format`/`target` options are valid; invalid configs can yield no output","Run `hugo --logLevel debug` to see esbuild diagnostics before the missing-output error"],"tags":["esbuild","javascript","asset-pipeline","hugo"],"analyzedSha":"8a468df065a75c1c7cf9f6850f32148746590ea5","analyzedAt":"2026-07-31T21:23:07.045Z","schemaVersion":2}