Open JWorthe opened 3 years ago
It would also be good to wrap the javascript generated by wasm-pack in an if (window.WebAssembly)
, since it will fetch and try to initialize the wasm file (which might be big) regardless on if it can actually use it or not.
We should probably move this issue to wasmbl
This is difficult to figure out how best to support from a web-bundler perspective.
In my index.html, I've started including the following. In this case, when the webassembly is loaded, Seed will take over the 'app' div.
The important parts here:
Something that's missing here is that there isn't any error handling if the .wasm file fails to load, since web-bundler doesn't expose the wasm fetching code generated by wasm-pack.
I think each site might do different things with these, but I think the list of error events is the same for all sites. It would be nice if web-bundler exposed them in some unified way.