trunk icon indicating copy to clipboard operation
trunk copied to clipboard

Support custom build command / other wasm targets

Open wooden-worm opened this issue 1 year ago • 3 comments

Problem

Trunk is currently hard coded to build for wasm32-unknown-unknown, making it hard to work with other wasm targets (wasm64, wasi targets)

Solution

A simple way to unblock other wasm targets is to provide an option to disable the default wasm32 build. I think a default_build = true entry in Trunk.toml would suffice. If the option is explicitly set to false, we just don't add the default wasm32 build here https://github.com/trunk-rs/trunk/blob/d61478448bd093449708b63dcb3e7baf286a191c/src/pipelines/html.rs#L150

See this discussion for more context.

If this is the right approach I can work on a PR.

wooden-worm avatar Jul 25 '24 06:07 wooden-worm

I think all Rust based options would go here: https://github.com/trunk-rs/trunk/blob/d61478448bd093449708b63dcb3e7baf286a191c/src/pipelines/rust/mod.rs

Extracted by https://github.com/trunk-rs/trunk/blob/d61478448bd093449708b63dcb3e7baf286a191c/src/pipelines/rust/mod.rs#L123 from the link element for rust.

I think having the ability to request the default would be good. But it might also be good to have the ability to just specify that target. Maybe that can be combined with a magic value (like target=*) to fall back to the default (vs trunk's default of wasm32).

ctron avatar Jul 25 '24 07:07 ctron

Having a target config option sounds good to me. I think we can just have the default value of wasm32-unknown-unknown, which works as it does now. Adding support for others could come later. Until then, having a none option would also unblock other targets?

wooden-worm avatar Jul 25 '24 17:07 wooden-worm

Might be tricky to have a default value and None at the same time. That's why I had the idea of * (or some other magic string).

ctron avatar Jul 26 '24 05:07 ctron