three-d
three-d copied to clipboard
Use `trunk` instead of `wasm-pack`
See the discussion in #273 for details
The main issue with wasm at the moment is building / running examples.
both wasm-pack and trunk need the examples to be separate crates.
wasm-pack additionally needs a separate "start" function for wasm_bindgen put into lib.rs
.
by adding trunk, you could skip that lib.rs
part and just rely on a main function similar to native builds.
but trunk still needs you to manually cd
into the example's directory before you can build / run it.
It will be fixed with https://github.com/thedodd/trunk/issues/290 , and then, we don't even need the examples to be separated out into crates.
just use a normal layout like
src/
**.rs
Cargo.toml
examples/
triangle.rs
pbr.rs
egui.rs
and they will work with a simple trunk serve --example=triangle
from crate root as you would expect without cd
ing into examples.
if we are going to add trunk anyway, i recommend waiting for that issue first which would make trunk more attractive.
and they will work with a simple trunk serve --example=triangle from crate root as you would expect without
cd
ing into examples.
That would be super nice!