Skip to content
This repository was archived by the owner on Oct 21, 2024. It is now read-only.

Commit 92f90da

Browse files
committed
config: fix issue where sst crashes on certain invalid config build
errors
1 parent f6ef244 commit 92f90da

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

pkg/js/js.go

+5-6
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,7 @@ const __dirname = topLevelFileUrlToPath(new topLevelURL(".", import.meta.url))
5959
})
6060
if len(result.Errors) > 0 {
6161
for _, err := range result.Errors {
62-
slog.Error("esbuild error",
63-
"text", err.Text,
64-
"location.file", err.Location.File,
65-
"location.line", err.Location.Line,
66-
"column", err.Location.Column,
67-
)
62+
slog.Error("esbuild error", "text", err.Text)
6863
}
6964
return result, fmt.Errorf("%s", FormatError(result.Errors))
7065
}
@@ -76,6 +71,10 @@ const __dirname = topLevelFileUrlToPath(new topLevelURL(".", import.meta.url))
7671
func FormatError(input []esbuild.Message) string {
7772
lines := []string{}
7873
for _, err := range input {
74+
if err.Location == nil {
75+
lines = append(lines, fmt.Sprintf("%v", err.Text))
76+
continue
77+
}
7978
lines = append(lines, fmt.Sprintf("%v:%v:%v: %v", err.Location.File, err.Location.Line, err.Location.Column, err.Text))
8079
}
8180
return strings.Join(lines, "\n")

0 commit comments

Comments
 (0)