-
Notifications
You must be signed in to change notification settings - Fork 404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
better wasm2js support #820
Comments
Implementation note: wasm2js introduction should wait until #750 merged, as it'll be easier. |
Support of asm.js from wasm-pack will be awesome. I really miss simple solution of producing fallback that will be compatible with non-wasm browsers. |
Would also like to have an asm.js fallback support in wasm-pack, this would make using/integrating wasm modules much more feasible in real-world projects |
Compatibility for non-wasm browsers would be a life-safer now that V8 and thus Chrome 91 broke WASM support, for now breaking the whole Rust-on-the-web-client ecosystem. Btw, is there any known work-around the lack of |
No but it looks not so difficult to do. There is a One option is to add an option to Other option is to clone |
💡 Feature description
It would be great if we could use wasm-pack's
build
command to generate a js file that we'd get by calling wasm2js to (potentially) support browsers that don't have native wasm support. The output build files would contain an additional js file from wasm2js and potentially slightly different.js
files for bootstrap logic.I am not advocating for installing/requiring more tooling by default, but if a user wanted to opt into building additional assets it could handle install/setup for them like I assume the
wasm-pack test
commands do today.I was able to get the wasm game of life example working with some slight adjustments to the already built wasm-pack files.
.wasm
file in the bootstrap js__wbindgen_throw
method since it created import loading order error with js modulesIf the output from wasm2js is not consistent across wasm projects (aka: it's broken in many situations or creates unmaintainable expectations for projects) then it's best to keep it entirely separate. However, if there's a chance it could just work it'd be helpful to be in supported in wasm-pack.
💻 Basic example
wasm-pack build --wasm2js
If having first-class support is not something that's desired in wasm-pack, then some small alterations to the assets built today could make it a one-line change to run a js version of a wasm asset by changing how we export/setup
__wbindgen_throw
.Thanks for your time!
The text was updated successfully, but these errors were encountered: