A Rollup plugin that compiles Rust code into WebAssembly modules, enabling seamless interop between Rust and JavaScript projects. Version 1.2.0, currently in active development with no recent updates. Requires Node >= 8.9.0, Rollup >= 0.64.0, and Rust nightly with wasm32-unknown-unknown target. Supports various export modes (WebAssembly.Instance, WebAssembly.Module, buffer), release/debug builds, and custom include/exclude patterns. Differentiates from other WASM plugins by focusing specifically on Rust compilation via the rustc compiler, offering tight integration with Rollup's build pipeline.
npm install rollup-plugin-rustVerified import paths — ran on the pinned version, not inferred.
Shows a minimal Rollup configuration using the plugin to compile Rust to WASM, and how to import and use the WASM module in JavaScript.
Use 'rustup default nightly' and install wasm32-unknown-unknown target.
Set 'target' option to a valid WASM target; other targets will fail compilation.
Consider using caching or incremental compilation in Rust (nightly feature).
Upgrade Node to v12 or later and test compatibility; consider using an alternative plugin with newer maintenance.
Use './lib.rs' (with extension) in import statements.
Ensure 'lib.rs' exists at the specified path and that 'include' option in plugin configuration matches the file.
Run 'rustup target add wasm32-unknown-unknown' and ensure Rust is on nightly channel.
Use 'import rust from "rollup-plugin-rust"' or 'const rust = require("rollup-plugin-rust").default'.Verify that your import statement points to a .rs file and the file exists.
No dependency data recorded yet.