TLDR
How can I resolve wasm-bindgen schema version incompatibilities between Nix flake-provided dependencies, when the instructions given in the error message suggest messing around with modifications of state?
Details
I’m trying to use trunk to build the WASM version of an egui app which lives in a package in a workspace.
The workspace has a flake.nix
which uses the oxalica Rust overlay which uses
this `rust-toolchain.toml`
[toolchain]
channel = "1.82.0"
profile = "default"
components = [ "rust-analyzer", "clippy", "rust-src", "rustfmt" ]
targets = [ "wasm32-unknown-unknown" ]
to provide the Rust tools, including the wasm32-unknown-unknown
target.
The flake also includes pkgs.trunk
for building the WASM version of the app. Running trunk serve
fails with
this error message
it looks like the Rust project used to create this wasm file was linked against
version of wasm-bindgen that uses a different bindgen format than this binary:
rust wasm file schema version: 0.2.95
this binary schema version: 0.2.93 (bf9807c5a)
Currently the bindgen format is unstable enough that these two schema versions
must exactly match. You can accomplish this by either updating this binary or
the wasm-bindgen dependency in the Rust project.
You should be able to update the wasm-bindgen dependency with:
cargo update -p wasm-bindgen --precise 0.2.93 (bf9807c5a)
don't forget to recompile your wasm file! Alternatively, you can update the
binary with:
cargo install -f wasm-bindgen-cli --version 0.2.95
How can I get around this problem in a declarative way?