Skip to content

fix(web): SPA black screen — vendor @noble/hashes/pbkdf2 + importmap guard#44

Merged
frahlg merged 1 commit into
mainfrom
fix-spa-pbkdf2-importmap
Jun 13, 2026
Merged

fix(web): SPA black screen — vendor @noble/hashes/pbkdf2 + importmap guard#44
frahlg merged 1 commit into
mainfrom
fix-spa-pbkdf2-importmap

Conversation

@frahlg

@frahlg frahlg commented Jun 13, 2026

Copy link
Copy Markdown
Member

Production hotfix for the v0.5.0 SPA: pairing (and any sign-in) showed a black
screen, nothing happened.

Root cause

B1.5 moved wallet derivation into the sign-in path, so app.js's module graph now imports
web/src/wallet/bip39.js@noble/hashes/pbkdf2 in the browser for the first time.
That specifier was never in the index.html importmap (node tests resolve it via
node_modules, so they passed), so the browser threw Failed to resolve module specifier
and the entire module graph failed to load → black screen on boot.

Fix

  • Vendor a bundled web/vendor/noble-hashes-pbkdf2.js (esbuild, matching the other vendored
    @noble files), add the importmap entry, precache it in sw.js.
  • Regression guard web/test/importmap.test.js: every bare specifier under web/src
    must be in the importmap, and every importmap target must exist on disk — the browser
    resolution check node tests couldn't do before. This would have caught the bug.

Verified

  • npm test 95/95. Served web/ locally and loaded it in Chrome: app boots to the sign-in
    gate, no module-resolution errors in the console (only unrelated extension noise).

Once merged I redeploy the SPA (deploy/lightsail/redeploy.sh) to fix the live site.

🤖 Generated with Claude Code

…reen)

B1.5 pulled deriveWallet into the sign-in path, so app.js's module graph
now imports web/src/wallet/bip39.js -> '@noble/hashes/pbkdf2' for the
first time in the BROWSER. That specifier was never in the index.html
importmap (only node tests exercised bip39, where it resolves via
node_modules), so the browser failed to resolve it and the whole graph
never loaded — a black screen on boot (seen when pairing).

Fix: vendor a bundled noble-hashes-pbkdf2.js, add the importmap entry,
precache it in sw.js. Add web/test/importmap.test.js as a regression
guard: every bare specifier under web/src must be in the importmap, and
every importmap target must exist on disk — the check node tests couldn't
do before. Verified in a real browser: the app boots to the sign-in gate.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@frahlg frahlg merged commit f057e48 into main Jun 13, 2026
2 checks passed
@frahlg frahlg deleted the fix-spa-pbkdf2-importmap branch June 13, 2026 14:00
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