Skip to content

Fix WebGL builds: emscripten-safe jslib syntax + crash-safe key stripper stash#1

Open
blockmaker-ai wants to merge 3 commits into
devfrom
fix/webgl-emscripten-syntax
Open

Fix WebGL builds: emscripten-safe jslib syntax + crash-safe key stripper stash#1
blockmaker-ai wants to merge 3 commits into
devfrom
fix/webgl-emscripten-syntax

Conversation

@blockmaker-ai

Copy link
Copy Markdown
Owner

Two fixes discovered building Polaris for WebGL:

  1. Wallet bridge jslib broke every WebGL build: emscripten's acorn-optimizer cannot convert dynamic import() and optional-chaining AST nodes (MOZ_TO_ME[node.type] is not a function). Rewrote the 5 dynamic imports via Function-constructor indirection and the 3 optional chains as explicit guards. Behavior unchanged; syntax-checked.

  2. Key stripper could permanently blank apiKeys: the SessionState stash dies with the editor session, so a failed/cancelled batchmode build (exactly what a broken jslib causes) lost the stash before restore. Stash now lives in Library/blockmaker-stripped-keys.json, which survives restarts so the InitializeOnLoadMethod safety net actually works. Verified red→green in a consumer project.

🤖 Generated with Claude Code

blockmaker-ai and others added 3 commits July 7, 2026 10:07
Unity's emscripten acorn-optimizer (JSDCE/minify pass) cannot convert
dynamic import() and optional-chaining AST nodes, failing every WebGL
build that includes this plugin with 'MOZ_TO_ME[node.type] is not a
function'. Rewrite the 5 dynamic imports via Function-constructor
indirection (string bodies are not parsed) and the 3 optional chains
as explicit guards. Behavior unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
SessionState dies with the editor session — a failed/cancelled batchmode
build exits before OnPostprocessBuild, losing the stash and permanently
blanking every BlockmakerConfig apiKey. A Library/ file survives editor
restarts, so the InitializeOnLoadMethod safety net can actually restore.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Brings the branch up to dev's head (17 commits): Pera-on-WebGL via the
official @perawallet/connect (WCv1, vendored-first), step-2 sign-in
RESEND/CANCEL UX, SessionRestoreSettled, session-gated balance/profile
polling, build-safe UI glyphs, and dev's independent duplicate of this
branch's emscripten jslib fix (6e53795 supersedes f5b8a56 where they
touched the same xchain optional chains).

Reconciliation on top of the auto-merge: dev's new Pera loader section
introduced two bare dynamic import() calls (@perawallet/connect, algosdk)
— the exact AST node Unity's emscripten acorn pass cannot parse
('MOZ_TO_ME[node.type] is not a function'), which is this branch's whole
reason for existing. Rewrote both via the same Function-constructor
indirection f5b8a56 used; behavior unchanged.

The branch's unique key-stripper commit (74032f7: stash to Library/ file,
not SessionState; restore gated on !BuildPipeline.isBuildingPlayer) is
untouched by dev and survives intact.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant