Skip to content

Enable WebAssembly compilation#663

Open
Marc-Andrieu wants to merge 9 commits intomainfrom
feat/wasm
Open

Enable WebAssembly compilation#663
Marc-Andrieu wants to merge 9 commits intomainfrom
feat/wasm

Conversation

@Marc-Andrieu
Copy link
Member

@Marc-Andrieu Marc-Andrieu commented Mar 7, 2026

Description

Just for the fun of having the web version as fast as the mobile ones.

  1. It launches really fast in dev (the 4s builds is just caching of the previous 1mn build):
Enregistrement.de.l.ecran.2026-03-07.011012.mp4
  1. It launches really fast in pre-prod environment (like, 2x faster on average, up to 2.5x faster). The pure JS alpha on the left, the pre-prod with WASM on the right.
    The dream of Titan web loading consistently in less than 4s is achieved:
Enregistrement.de.l.ecran.2026-03-07.142812.mp4

Summary

Part 3/3 of #646: use WASM builds (part 1 was serving files compressed ahead-of-time, part 2 was ensuring every page is loaded lazily)

Note on COOP/COEP headers: these two same headers are used both to multithread WASM-compiled apps and to enable/disable cross-origin isolation, which we CANNOT support (because this breaks popup behavior, so impossible to log in and to fund with HelloAsso, which are basically our two most used features).
See sources below and issues (this is not my 1st attempt at supporting WebAssembly in dev & build):

Issues/PR dependencies

Issues to be resolved

Required PRs

Changes Made

  • Add consistent values for the COOP/COEP headers, both in web_dev_config.yaml and in the nginx config
  • Use the brand new flag, so that you just need to suffix --wasm --no-cross-origin-isolation (e.g. flutter run --dart-define=flavor=alpha --wasm --no-cross-origin-isolation)
    • Document on this in the README.md, expand the launch.json, etc
  • Use package:web for the login & HA popups
    • Pass tests
    • Use condition imports, or factorize with some callback arg

Classification

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 🔨 Refactor (non-breaking change that neither fixes a bug nor adds a feature)
  • 🔧 Infra CI/CD (changes to configs of workflows)
  • 💥 BREAKING CHANGE (fix or feature that require a new minimal version of the front-end)
  • 😶‍🌫️ No impact for the end-users

Impact & Scope

  • Core functionality changes
  • Single module changes
  • Multiple modules changes
  • Other: headers config (web_dev_config.yaml for dev, nginx.conf for builds)

Testing

  • 1. Tested this locally
  • 2. Added/modified tests that pass the CI (or tested in a downstream fork)
  • 3. Tested in a local client using a pre-prod backend
  • 4. Build the Docker image and tested the container behavior
  • 5. Test in the front-end pre-prod
  • 0. Untestable (exceptionally), will be tested in prod directly

Documentation

  • Updated the docs accordingly :
  • // Inline comments
  • No documentation needed

@Marc-Andrieu Marc-Andrieu self-assigned this Mar 7, 2026
@Marc-Andrieu Marc-Andrieu added core This PR change the core web optimisation labels Mar 7, 2026
@codecov-commenter
Copy link

codecov-commenter commented Mar 13, 2026

Codecov Report

❌ Patch coverage is 0% with 24 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.98%. Comparing base (62f43a4) to head (919880f).

Files with missing lines Patch % Lines
lib/auth/providers/openid_provider.dart 0.00% 22 Missing ⚠️
lib/tools/web-window-callback/else.dart 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #663      +/-   ##
==========================================
+ Coverage   50.88%   50.98%   +0.10%     
==========================================
  Files         167      168       +1     
  Lines        3797     3789       -8     
==========================================
  Hits         1932     1932              
+ Misses       1865     1857       -8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Marc-Andrieu Marc-Andrieu marked this pull request as ready for review March 13, 2026 15:41
Copy link
Member

@maximeroucher maximeroucher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really great job !!

login(event.data);
}
});
void helloAssoCallback2(String fundingUrl) async {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove the 2 please 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core This PR change the core optimisation web

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Different behavior with and without --wasm [Web] Running with --wasm shouldn't set window.crossOriginIsolated to true

4 participants