Skip to content

fix: lazy load to prevent instant downloads of wasm on page load#160

Merged
irubido merged 1 commit intomainfrom
fix/update-fix-NU6
Feb 13, 2026
Merged

fix: lazy load to prevent instant downloads of wasm on page load#160
irubido merged 1 commit intomainfrom
fix/update-fix-NU6

Conversation

@sqhell
Copy link
Contributor

@sqhell sqhell commented Feb 11, 2026

Changes

  • Add clean step to build script (rm -rf dist &&) to prevent old hashed WASM files from accumulating across builds
  • Simplify source to single entry point (removed worker helper from entry array) - Parcel now discovers workers through imports, eliminating duplicate
    WASM in single build
  • Implement lazy-loading: WASM files (60MB) now download only when user clicks "Connect MetaMask Snap" instead of on page load
  • Add yellow "Z" favicon as inline SVG
  • Improve error handling for MetaMask connection rejections (code 4001)

Tests

Verify no duplicate accumulation:
cd packages/web-wallet
yarn build
ls -la dist/.wasm # Should show exactly 2 files
yarn build
ls -la dist/
.wasm # Should still show exactly 2 files (no accumulation)
du -sh dist/ # Should be ~66MB

Verify lazy-loading:

Open http://localhost:3000 in incognito

DevTools → Network → filter "wasm"

Refresh page → should show 0 WASM files

Click "Connect MetaMask Snap" → now WASM files download

Bandwidth impact:

  • Before: 5 WASM files (~178MB) deployed
  • After: 2 WASM files (~60MB) deployed
  • Casual visitors: 0 WASM bandwidth (lazy-load)

Issues

  • Addresses bandwidth spike from 27GB → 174GB/month by eliminating duplicate WASM files
  • Reduces new visitor bandwidth cost from ~178MB → ~60MB compressed (~55MB over wire)
  • Eliminates WASM download for visitors who don't connect (landing page browsing)

@sqhell sqhell requested a review from irubido February 11, 2026 16:53
@irubido irubido merged commit 5d9b423 into main Feb 13, 2026
4 checks passed
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.

2 participants

Comments