Skip to content

Commit cb58cbd

Browse files
committed
chore(site): fix wasm build, update build scripts
1 parent 6270fa3 commit cb58cbd

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

cmd/wasm/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func newWush(jsConfig js.Value) map[string]any {
7474
panic(err)
7575
}
7676

77-
s, err := tsserver.NewServer(ctx, logger, send)
77+
s, err := tsserver.NewServer(ctx, logger, send, dm)
7878
if err != nil {
7979
panic(err)
8080
}

site/build_wasm.sh

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
3+
set -eux
4+
5+
cd "$(dirname "$0")"
6+
7+
GOOS=js GOARCH=wasm go build -ldflags="-s -w" -o ./app/assets/main.wasm ../cmd/wasm
8+
wasm-opt -Oz ./app/assets/main.wasm -o ./app/assets/main.wasm --enable-bulk-memory

site/deploy.sh

+5-2
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,18 @@ set -eux
44

55
cd "$(dirname "$0")"
66

7-
GOOS=js GOARCH=wasm go build -ldflags="-s -w" -o ./app/assets/main.wasm ../cmd/wasm
8-
wasm-opt -Oz ./app/assets/main.wasm -o ./app/assets/main.wasm --enable-bulk-memory
7+
./build_wasm.sh
98

109
pnpm build
1110

11+
# The wasm artifact is too big uncompressed to serve directly from cf pages, so
12+
# we manually serve the gzipped wasm from google storage. I would use r2 but
13+
# it's broken and won't let us activate.
1214
gsutil -h "Content-Type:application/wasm" \
1315
-h "Content-Encoding:gzip" \
1416
-h "Cache-Control:public,max-age=31536000,immutable" \
1517
cp ./build/client/assets/main-*.wasm.gz gs://wush-assets-prod/assets/
18+
# rm the wasm files so they don't get uploaded to cf pages.
1619
rm ./build/client/assets/main-*.wasm*
1720

1821
wrangler pages deploy ./build/client

0 commit comments

Comments
 (0)