Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
This is a point of coordination for work that JS bundlers are doing along two fronts:
The former is connected to our npm integration story, but will probably not be Rust-specific, since the npm packages will likely just contain a compiled .wasm blob.
Update: we met with the Parcel team and had a great discussion!
The main focus was on how we ultimately want to support Rust libraries getting pulled in. The short story is:
We should be able to publish an npm package that has:
The bundler is set up to allow you to import from .wasm files as if they were ES modules, so it will natively understand what's going on, and generate the appropriate code to instantiate the .wasm module. Parcel does not yet support imports from .wasm modules, but they will start working on that now.
Note that this model is not in any way tied to Rust. In particular, the wasm-bindgen tool is ultimately intended to be language-agnostic.
We intend to chat again with Webpack to see whether they are following a similar plan.
I've updated wasm-bindgen with the results of the discussion ("everything is an ES6 module") and it's got some examples about how it all works!
Another point to add to this is that we're expecting bundlers will also resolve the imports of a wasm file itself as if it were an ES6 module. In that sense the bundler is the one that's ultimately responsible for resolving the wasm modules imports (in addition to instantiation)