-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Move "helper functions" in JS to an NPM package #185
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
Comments
cc @xtuc |
This also is likely to have ramifications on #42 and #18, generating |
Awesome. I think I can take this one 😊 |
Ok! One tricky part I think is how this interacts with the no modules mode and how the wasm-bindgen output is not as usable by default, and I'm not sure how to best tackle those issues |
Also it has some other advantages:
Note that this would only work with Rollup and Webpack (currently). I mentioned during the meeting that it could make sense to compile Rust's This solution avoids porting the libs to JavaScript, which I believe has many limitations (pthread? i64?). |
Related to this: would be great to have a
|
I'm gonna close this for now because the shim functions are still in so much churn I'm not sure if it's feasible to extract them to a helper package at this time. Additionally I think it'll be quite some time before this causes bloat in applications, so we can hopefully cross the bridge when we get there! |
Right now all the helper functions are generated inline in the JS that
wasm-bindgen
generates, but this can be a problem if you have multiplewasm-bindgen
-generated wasm files throughout your dependency graph in a larger JS application. Eachwasm-bindgen
-generated project would duplicate the shims (that probably look the same) and so there's not as much code sharing happening, bummer!It'd be pretty slick if all the helper functions were located on npm already in a package that wasm-bindgen generates imports to. That way all the
wasm-bindgen
-generated projects would import the same glue and it'd make everything smaller.I think if this were implemented the JS file that we generate is basically then just the bare minimum to wrap the wasm imports/exports of the Rust/C code, and it'd make it a bit smaller!
The text was updated successfully, but these errors were encountered: