Skip to content

Instantly share code, notes, and snippets.

@matthewjberger
Last active November 19, 2023 23:05
Show Gist options
  • Save matthewjberger/e5d6b5c7c6437f55073dd6949aa51943 to your computer and use it in GitHub Desktop.
Save matthewjberger/e5d6b5c7c6437f55073dd6949aa51943 to your computer and use it in GitHub Desktop.
Check if a rust crate is compatible with wasm + tips

Does it build in wasm?

cargo build --target wasm32-unknown-unknown

How do I specify crates just for the wasm target?

Here's an example using legion:

[package]
...

[dependencies]
legion = "0.4.0"
...
[target.'cfg(target_arch = "wasm32")'.dependencies]
legion = { version = "0.4.0", default-features = false, features = [
    "wasm-bindgen",
] }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment