trunk-rs / trunk

Build, bundle & ship your Rust WASM application to the web.
https://trunkrs.dev/
Apache License 2.0
3.43k stars 251 forks source link

nightly rust feature #854

Open F8RZD opened 1 month ago

F8RZD commented 1 month ago

does trunk support adding nightly flags to rustc and cargo ?

I'm specifically interested in build_std and panic_immediate_abort. combination of these two practically removes all panic related boiler plate and strings reducing the binary size drastically which is an essential need in wasm.

does trunk support passing those arguments?

ctron commented 1 week ago

Sorry for the late response. I seem to have overlooked this one.

Right now, as far as I remember, you can't add flags like this.

However, you can add a rust-toolchain.toml, to choose the nightly (or other) toolchain explicitly. And you should be able to use .cargo/config (rustflags) to specify additional arguments.

So it should all be provided by standard Rust tooling.

BGR360 commented 1 week ago

I could really use an option in Trunk to pass arbitrary flags to cargo.

My use case is the same as @F8RZD, except I need to not supply those flags when building my project for non-web platforms.

The only way I've been able to find to do this is by having a separate Cargo config file .config/web.toml and to pass --config .config/web.toml to every Cargo command. Cargo does not provide any way to statically configure whether the build-std feature should be used depending on the target.

I would be happy with any of the following implementations in Trunk: