{"id":42246,"library":"vite-plugin-rsw","title":"vite-plugin-rsw","description":"A wasm-pack plugin for Vite that enables WebAssembly integration via Rust crates. v2.0.11 requires Vite >=2.8.0 and supports HMR, friendly error messages, and automatic rebuilding. It relies on the `rsw` CLI tool (cargo install rsw) to manage Rust crate generation and linking. Differentiated by its seamless Vite plugin approach vs manual wasm-pack setup. Active development.","status":"active","version":"2.0.11","language":"javascript","source_language":"en","source_url":"https://github.com/lencx/vite-plugin-rsw","tags":["javascript","rsw","wasm","vite","plugin","wasm-pack","vite-plugin","webAssembly","typescript"],"install":[{"cmd":"npm install vite-plugin-rsw","lang":"bash","label":"npm"},{"cmd":"yarn add vite-plugin-rsw","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-plugin-rsw","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency: required as plugin host, version >=2.8.0","package":"vite","optional":false}],"imports":[{"note":"Named export, not default.","wrong":"import ViteRsw from 'vite-plugin-rsw'","symbol":"ViteRsw","correct":"import { ViteRsw } from 'vite-plugin-rsw'"},{"note":"CommonJS requires destructuring.","wrong":"const ViteRsw = require('vite-plugin-rsw')","symbol":"ViteRsw (CommonJS)","correct":"const { ViteRsw } = require('vite-plugin-rsw')"},{"note":"Option type available for TypeScript users.","wrong":null,"symbol":"ViteRsw (type import)","correct":"import type { ViteRswOptions } from 'vite-plugin-rsw'"}],"quickstart":{"code":"// vite.config.ts\nimport { defineConfig } from 'vite';\nimport { ViteRsw } from 'vite-plugin-rsw';\n\nexport default defineConfig({\n  plugins: [ViteRsw()],\n});\n\n// Then ensure rsw tool is installed:\n// cargo install rsw\n// Initialize: yarn rsw init\n// Generate crate: yarn rsw new rsw-hello\n// Configure rsw.toml with [[crates]] name and link=true","lang":"typescript","description":"Shows basic setup: import plugin, add to Vite config, install rsw CLI, generate and link a Rust crate."},"warnings":[{"fix":"Run `cargo install rsw`","message":"Requires rsw CLI to be installed via cargo before use","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Set link = true under [[crates]] in rsw.toml","message":"rsw.toml must have link=true for the crate to be linked","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Upgrade Vite to >=2.8.0","message":"Vite peer dependency changed from >=2.4.0 to >=2.8.0 in v2.0.0","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Use script: 'rsw watch & vite' (or concurrently)","message":"Must run `rsw watch` and Vite separately for dev with HMR","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Use script: 'rsw build && tsc && vite build'","message":"Build script requires running `rsw build` before Vite build","severity":"gotcha","affected_versions":">=2.0.0"}],"env_vars":null,"search_vec":"'2.8.0':22 'activ':62 'approach':55 'automat':30 'cargo':39 'cli':37 'crate':18,45 'develop':63 'differenti':49 'enabl':13 'error':27 'friend':26 'generat':46 'hmr':25 'instal':40 'integr':15 'javascript':64 'link':48 'manag':43 'manual':57 'messag':28 'pack':8,60,71 'plugin':3,9,54,68,74 'rebuild':31 'reli':33 'requir':20 'rsw':4,36,41,65 'rust':17,44 'seamless':52 'setup':61 'support':24 'tool':38 'typescript':76 'v2.0.11':19 'via':16 'vite':2,11,21,53,67,73 'vite-plugin':72 'vite-plugin-rsw':1 'vs':56 'wasm':7,59,66,70 'wasm-pack':6,58,69 'webassembl':14,75","created_at":"2026-06-04T18:56:19.993787+00:00","updated_at":"2026-06-04T18:56:19.993787+00:00","problems":[{"fix":"Install via npm/yarn: npm i -D vite-plugin-rsw","cause":"Package not installed or import path wrong","error":"Error: Cannot find module 'vite-plugin-rsw'"},{"fix":"Switch to Rust nightly: rustup default nightly","cause":"Rust nightly feature required by generated crate","error":"error[E0554]: `#![feature]` may not be used on the stable release channel"},{"fix":"Ensure Rust, wasm-pack, and required target (e.g., wasm32-unknown-unknown) are installed","cause":"Missing Rust toolchain or crate errors","error":"Error: wasm-pack build failed"},{"fix":"Run `yarn rsw init` to generate rsw.toml","cause":"Missing configuration file in project root","error":"Error: rsw.toml not found"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/lencx/vite-plugin-rsw","github":"https://github.com/lencx/vite-plugin-rsw","docs":null,"changelog":null,"pypi":null,"npm":"vite-plugin-rsw","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}