Unable to build egui project using 'trunk serve'

157 views Asked by At

I'm trying to learn a bit of Rust by building a small app using egui. The goal is to compile the project to wasm using trunk. However whenever I try to use trunk serve I get a bunch of errors. Specifically it seems that during the build process it is unable to build the dependency "mio-0.8.8" (which is not directly included in the project). The whole thing can be found here (TL;DR mainly import and module errors).

My Cargo.toml for reference:

[package]
name = "test-app"
version = "0.1.0"
edition = "2021"

[lib]
crate-type = ["cdylib", "rlib"]

[dependencies]
eframe = { version = "0.23.0", features = ["persistence"] }
rumqttc = "0.22.0"
serde = { version = "1.0.162", features = ["derive"] }
serde_json = "1.0.96"
wasm-bindgen-futures = "0.4.37"
gloo-timers = "0.3.0"

[target.'cfg(target_arch = "wasm32")'.dependencies]
tracing-wasm = "0.2.0"

[profile.release]
opt-level = 2 # fast and small wasm

[profile.dev.package."*"]
opt-level = 2

So far I've tried the following things (both on Windows and through WSL):

  • (Re)installing the wasm-bindgen-cli as stated in trunk's Github repo
  • rustup update
  • Including mio in the Cargo.toml as a dependency
  • (Re)installing the wasm32-unknown-unknown target
  • Using wasm-pack (with this one even more dependencies aren't able to be built)

So far none of this has worked and I haven't yet found a solution elsewhere so I thought I'd ask here. Is there some specific thing I need to setup for this to work?

0

There are 0 answers