Skip to content
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

Enable WebAssembly reference types #82

Open
Electroid opened this issue Nov 5, 2021 · 3 comments
Open

Enable WebAssembly reference types #82

Electroid opened this issue Nov 5, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@Electroid
Copy link

The Workers runtime recently updated to V8 9.6, which has support for WebAssembly reference types. wasm-bindgen also has support with an optional flag: https://rustwasm.github.io/wasm-bindgen/reference/reference-types.html

@nilslice
Copy link
Contributor

nilslice commented Nov 5, 2021

We use wasm-bindgen through wasm-pack which has had this related PR open for a while: rustwasm/wasm-pack#888

I may take a look at it in the next week or so. Definitely would be nice to take advantage of this now that we have it supported!

EDIT: it's also maybe time to consider dropping wasm-pack as the intermediary, and just call wasm-bindgen directly. Will investigate.

@nilslice nilslice added the enhancement New feature or request label Nov 5, 2021
@allsey87
Copy link

allsey87 commented Jun 14, 2022

it's also maybe time to consider dropping wasm-pack as the intermediary, and just call wasm-bindgen directly. Will investigate.

Any news on this front? My two cents would be that wasm-pack and also this repository's worker-build include too much and try to hide too much from the developer. I would much rather have clear documentation about how to transform the output of wasm-bindgen to something that can be consumed by wrangler.

For example, in my case, I already use WebAssembly on my front-end and would like to build all my crates with a single innovation of cargo build and to use webpack for bundling instead of swc (since webpack is already used for the front-end), but wasm-pack/worker-build makes this very awkward.

@nxmaintainer
Copy link

Just in case, this issue can be closed, you can use --reference-types now via modifying wrangler.toml's build command (I believe it should be the default behavior, it's a big advantage and performance boost in many cases):

[build]
command = "cargo install -q worker-build --version 0.0.7 && worker-build --release --reference-types"

P.S. It's possible due to wasm-pack ability to pass those arguments to wasm-bindgen, and worker-build passes os-level arguments to wasm-pack (looks like it was the original design, which is great).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants