three-d icon indicating copy to clipboard operation
three-d copied to clipboard

Use `trunk` instead of `wasm-pack`

Open asny opened this issue 1 year ago • 2 comments

See the discussion in #273 for details

asny avatar Aug 10 '22 08:08 asny

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 cding into examples.

if we are going to add trunk anyway, i recommend waiting for that issue first which would make trunk more attractive.

coderedart avatar Aug 10 '22 17:08 coderedart

and they will work with a simple trunk serve --example=triangle from crate root as you would expect without cding into examples.

That would be super nice!

asny avatar Aug 10 '22 18:08 asny