How to set up `trunk` and `config.toml` in a workspace?
I'm struggling to figure out how to use `trunk` in a workspace. The main issue appears to be that one of my dependencies (`getrandom`) appears to require some extra flags when compiling to WASM, but I can't seem to figure out a way to pass those. I have tried placing `.cargo` in either the repo root, crate root, or even using environment variable, but neither has worked for me. I looked through the documentation, but I didn't find anything that would seem relevant.
```
RUSTFLAGS='--cfg getrandom_backend="wasm_js"' ./trunk build --release --config ./main_crate/Trunk.toml --public-url $public_url
2025-09-20T18:54:06.594586Z INFO 🚀 Starting trunk 0.21.14
2025-09-20T18:54:06.594884Z INFO 📦 starting build
Compiling unicode-ident v1.0.18
...
Compiling aes v0.8.4
error: The "wasm_js" backend requires the `wasm_js` feature for `getrandom`. For more information see: https://docs.rs/getrandom/0.3.3/#webassembly-support
--> /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/getrandom-0.3.3/src/backends.rs:34:17
|
34 | / compile_error!(concat!(
35 | | "The \"wasm_js\" backend requires the `wasm_js` feature \
36 | | for `getrandom`. For more information see: \
37 | | https://docs.rs/getrandom/", env!("CARGO_PKG_VERSION"), "/#webassembly-support"
38 | | ));
| |__________________^
```
关闭于 2025-09-21 2 条评论