Skip to content

Commit 64434e6

Browse files
committed
Fix sql-wasm.wasm 404 on GitHub Pages by patching absolute locateFile path
@cashapp/sqldelight-sqljs-worker bundles sql.js with a hardcoded locateFile: file => "/sql-wasm.wasm", which resolves against the site root instead of the /PeopleInSpace/ project-page subpath and 404s. GitHub then serves its 404 HTML page in place of the wasm binary, which the loader can't parse ("expected magic word... found <!DO"), leaving the app stuck on "Loading astronauts...". Patch the built chunk to use a relative path so it resolves correctly regardless of the deployment subpath. Verified locally by serving the patched dist output under a /PeopleInSpace/ subpath.
1 parent 74e9725 commit 64434e6

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

.github/workflows/build-and-publish-web.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ jobs:
2828
- name: Build web app
2929
run: ./gradlew :compose-web:wasmJsBrowserDistribution
3030

31+
- name: Fix absolute sql-wasm.wasm path for project-page subpath
32+
# @cashapp/sqldelight-sqljs-worker bundles sql.js with a hardcoded
33+
# locateFile: file => "/sql-wasm.wasm", which 404s once the site is
34+
# served from a subpath like /PeopleInSpace/ instead of the domain root.
35+
run: sed -i 's#"/sql-wasm.wasm"#"sql-wasm.wasm"#g' compose-web/build/dist/wasmJs/productionExecutable/*.js
36+
3137
- name: Deploy to GitHub Pages
3238
uses: JamesIves/github-pages-deploy-action@v4.9.0
3339
with:

0 commit comments

Comments
 (0)