Try out replacing GopherJS with Web Assembly
flosell opened this issue · 1 comments
flosell commented
GopherJS seems to be a few versions behind normal go releases, occasionally causing issues with library upgrades (e.g. gosec).
Go these days has native support for WebAssembly so this might be an easier way to get our web frontend in front of users;
Two main things to figure out:
- Is it possible to swap out GopherJS with Go WASM with reasonable effort?
- Does the switch preserve the current state of performance, artifact size (TinyGo might help there) and so on?
flosell commented
Tried this today:
- Go WASM produces significantly larger filesizes (>3mb), not a good option for browsers. Investigated a bit if that can be reduced but didn't find a quick fix so didn't pursue this for now
- TinyGo seems to work generally and would result in significantly smaller (500kb) files as a bonus. However, it seems to have quite a number of sharp edges on the JS-WASM interop - if it's not built in just the right way, it mysteriously doesn't work (e.g. string arguments to exported functions are simply empty) or raises warning about unimplemented functionality (that might result in memory leaks). All in all, didn't seem like something I'd want to dive in for a project that's only occasionally changed and should be easy to maintain
Might revisit this a bit later when things have improved