diff --git a/web/web_app.go b/web/web_app.go index 57af3dfa..3cc4dc75 100644 --- a/web/web_app.go +++ b/web/web_app.go @@ -7,6 +7,7 @@ import ( "errors" "fmt" "io/fs" + "mime" "net/http" "github.com/rs/zerolog/log" @@ -27,6 +28,12 @@ func WebAppHandler() (http.Handler, error) { // found. wrappedFS := WrapFS(fs, "index.html") + // Windows doesn't know this mime type. Web browsers won't load the webapp JS + // file when it's served as text/plain. + if err := mime.AddExtensionType(".js", "application/javascript"); err != nil { + return nil, fmt.Errorf("registering mime type for JavaScript files: %w", err) + } + return http.FileServer(http.FS(wrappedFS)), nil }