Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Add WebAssembly support #232
Prior to this PR, Vecty was only usable with GopherJS which would compile Go to JS code.
After this PR, Vecty can be used with:
All examples in the
TinyGo future support
In the future, Vecty will automatically gain support for TinyGo once it supports the subset of reflection and
See tinygo-org/tinygo#93 for more discussion around this.
Supersedes the prior PR for this by using build tags instead of exposing a
Looks like the ecosystem is maturing a bit so we're pretty closer to being able to merge this. Notable things that have happened recently:
No other errors, logs, etc. Unsure why. Doesn't affect other examples. cc @hajimehoshi if you have any ideas, otherwise I'll find more minimal case and file/fix upstream.
(Just checkout this branch and
@@ Coverage Diff @@ ## master #232 +/- ## ========================================== + Coverage 57.64% 59.41% +1.77% ========================================== Files 3 4 +1 Lines 654 653 -1 ========================================== + Hits 377 388 +11 + Misses 219 208 -11 + Partials 58 57 -1
Using blackfriday v2 with GopherJS and WebAssembly is not currently easily possible because with Go modules v2 must be imported as: ``` github.com/russross/blackfriday/v2 ``` But `gopherjs serve` cannot use that versioned import path, since it is not module-ware ([open issue](gopherjs/gopherjs#855)). So we end up stuck in a catch-22: Go 1.12 WebAssembly can't build `gopkg.in/russross/blackfriday.v2` anymore (import path must be suffixed with `/v2`) and GopherJS cannot build `github.com/russross/blackfriday/v2`. Initially I just tried downgrading to blackfriday v1 at `github.com/russross/blackfriday` but unfortunately that appears to have a different problem where module-aware builders like Go 1.12 are forced to use v2 but non-module-aware work fine, I suspect due to the `go.mod` comitted to that repo currently. This works for now, and the long term fix is GopherJS getting module-aware building.
Note that we still use a mock JS implementation for purposes of testing because syscall/js does not provide any such facilities today.
In some such as `TestRenderBody_RenderSkipper_Skip` it is not logically apparent to me how these ever passed on master before this, because the panic would have always led to RAF never being called unless `renderComponent` called RAF?
Good news! It's finally time for this to be merged: Vecty now has WebAssembly support!