cmd/tsconnect: prefetch main.wasm when serving

Avoids waterfalling of requests from the file (its load is triggered
from JavaScript).

Also has other cleanups to index.html, adding a <title> and moving the
<script> to being loaded sooner (but still not delaying page rendering
by using the defer attribute).

Fixes #5141
Fixes #5135

Signed-off-by: Mihai Parparita <mihai@tailscale.com>
This commit is contained in:
Mihai Parparita
2022-08-02 15:02:26 -07:00
committed by Mihai Parparita
parent f04bc31820
commit 52d769d35c
3 changed files with 18 additions and 1 deletions

View File

@@ -119,6 +119,9 @@ func runYarn(args ...string) error {
// from entry points to hashed file names.
type EsbuildMetadata struct {
Outputs map[string]struct {
Inputs map[string]struct {
BytesInOutput int64 `json:"bytesInOutput"`
} `json:"inputs,omitempty"`
EntryPoint string `json:"entryPoint,omitempty"`
} `json:"outputs,omitempty"`
}