mix compile.exclosured
(exclosured v0.1.4)
Copy Markdown
Mix compiler that builds Rust crates into WebAssembly.
Add :exclosured to your project's compilers list:
def project do
[
compilers: [:exclosured] ++ Mix.compilers(),
...
]
endConfiguration
config :exclosured,
source_dir: "native/wasm", # where Cargo.toml crates live
output_dir: "priv/static/wasm", # where .wasm + .js output goes
optimize: :none, # :none | :size | :speed (wasm-opt)
modules: [
my_mod: [],
heavy_compute: [features: ["simd"]],
sqlite: [
no_default_features: true,
features: ["bundled"],
env: [CC_wasm32_unknown_unknown: "/usr/bin/clang"],
cargo_args: ["--locked"]
]
]Module Options
Each module accepts the following options:
features- List of cargo features to enable (passed as--features a,b,c)no_default_features- Iftrue, passes--no-default-featuresto cargoenv- Keyword list of environment variables for the cargo build (e.g.,[CC_wasm32_unknown_unknown: "/usr/bin/clang"])cargo_args- List of extra arguments forwarded directly tocargo build(e.g.,["--locked", "--offline"])lib- Iftrue, marks this as a library crate (not compiled standalone)canvas- Iftrue, enables canvas integrationsubscribe- List of event subscriptions