Open MarcAntoine-Arnaud opened 3 years ago
Thanks for the report! This is something I'd be happy to help design and take a PR for, but I don't really know of a great design or how it would fit into wasm-bindgen
myself. There's already basically a server for wasm-bindgen-test
so that can probably be reused.
This would be a great feature to have though!
Hello,
I wanna to work on it, @alexcrichton do you have some advices ? Do you have idea what I need to check first ?
For me it means:
cargo build
command - maybe with watch optionThank you, Marc-Antoine
Yeah that's the rough shape of ideally what this would look like. I think it'd be good though to make a proposal for the interface for this and how it's expected to be used, though.
Motivation
Wasm-bindgen provide all requirements to generate Wasm application. Including the startup with the
#[wasm_bindgen(start)]
attribute. It miss a very little portion of code to:Today, it requires an external tool, hot reloading is not provided etc. It can be with WebPack: Paint example Or using the
wasm-bindgen-cli
GFX exampleOne of the paint/complex work is to manage cross target libraries. For example the Quad example from GFX is a
main
as it can run on all platforms. But the same code can also run for Web with WebAssembly. I have tried to manage that in that issue: https://github.com/gfx-rs/gfx/pull/3475 It works using 2 Cargo manifests, requires to duplicate dependencies and do some tricks.Proposed Solution
Improve the CLI crate to add a mode to serve the application. maybe to provide a command like:
wasm-bindgen --server
Or maybe add aserver
target.