Vite plugin (v0.1.12) that integrates Rust WebAssembly crates built with wasm-pack into Vite projects. It automatically serves local wasm-pack crates and supports npm-published wasm-pack packages (target web). The plugin wires up Vite's dev server and build pipeline to handle .wasm files and JavaScript glue code. It requires wasm-pack to be installed separately and the crate must be built beforehand. Compared to alternatives like vite-plugin-wasm, this plugin is specifically designed for wasm-pack output and offers simpler configuration for local crates.
npm install vite-plugin-wasm-packVerified import paths — ran on the pinned version, not inferred.
Shows how to configure Vite with a local wasm-pack crate and use its exports.
Run 'wasm-pack build ./my-crate --target web' before 'vite' or 'vite build'.
Rebuild the package with '--target web' or use a different plugin.
Clear Vite cache by deleting node_modules/.vite or restarting the dev server.
Run 'wasm-pack build ./my-crate --target web' and ensure the path matches.
Disable source maps in Vite config or ignore the error; it is non-blocking.
Provide an absolute or relative path to the crate directory containing Cargo.toml.