{"id":13417280,"url":"https://github.com/rwasm/vite-plugin-rsw","last_synced_at":"2025-12-24T04:26:19.517Z","repository":{"id":42133713,"uuid":"328314076","full_name":"rwasm/vite-plugin-rsw","owner":"rwasm","description":"🦞 wasm-pack plugin for Vite","archived":false,"fork":false,"pushed_at":"2023-06-12T16:32:37.000Z","size":12033,"stargazers_count":381,"open_issues_count":6,"forks_count":10,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-05-19T15:06:23.086Z","etag":null,"topics":["plugin","rsw","rsw-rs","rust","vite-plugin","vite-plugin-rsw","wasm","wasm-bindgen","wasm-pack","webassembly"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rwasm.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"open_collective":"vite-plugin-rsw"}},"created_at":"2021-01-10T05:54:29.000Z","updated_at":"2024-05-18T02:11:09.000Z","dependencies_parsed_at":"2024-01-07T18:04:43.348Z","dependency_job_id":"6c7dd36d-2d1d-40d9-821a-2cc90a1c32cd","html_url":"https://github.com/rwasm/vite-plugin-rsw","commit_stats":null,"previous_names":["lencx/vite-plugin-rsw"],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwasm%2Fvite-plugin-rsw","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwasm%2Fvite-plugin-rsw/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwasm%2Fvite-plugin-rsw/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rwasm%2Fvite-plugin-rsw/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rwasm","download_url":"https://codeload.github.com/rwasm/vite-plugin-rsw/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221304336,"owners_count":16794926,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["plugin","rsw","rsw-rs","rust","vite-plugin","vite-plugin-rsw","wasm","wasm-bindgen","wasm-pack","webassembly"],"created_at":"2024-07-30T22:00:34.865Z","updated_at":"2025-12-24T04:26:19.484Z","avatar_url":"https://github.com/rwasm.png","language":"TypeScript","funding_links":["https://opencollective.com/vite-plugin-rsw"],"categories":["Plugins","TypeScript","webassembly"],"sub_categories":["Framework-agnostic Plugins"],"readme":"# vite-plugin-rsw\n\n\u003e wasm-pack plugin for Vite\n\n[![npm](https://img.shields.io/npm/v/vite-plugin-rsw.svg)](https://www.npmjs.com/package/vite-plugin-rsw)\n[![npm downloads](https://img.shields.io/npm/dm/vite-plugin-rsw.svg)](https://npmjs.org/package/vite-plugin-rsw)\n[![vite version](https://img.shields.io/badge/Vite-^2.0.0-000000?style=flat\u0026labelColor=646cff)](https://github.com/vitejs/vite)\n[![chat](https://img.shields.io/badge/chat-discord-blue?style=flat\u0026logo=discord)](https://discord.gg/euyYWXTwmk)\n\n[![awesome-rsw](./assets/awesome-rsw.svg)](https://github.com/lencx/awesome-rsw)\n[![Rust](https://img.shields.io/badge/-Rust-DEA584?style=flat\u0026logo=rust\u0026logoColor=000000)](https://www.rust-lang.org)\n[![WebAssembly](https://img.shields.io/badge/-WebAssembly-654FF0?style=flat\u0026logo=webassembly\u0026logoColor=ffffff)](https://webassembly.org)\n\n|rsw version|vite version|\n|---|---|\n| \u003e= `2.0.0`| \u003e= `2.8.0`|\n| \u003e= `1.8.0`| \u003e= `2.4.0`|\n|`1.7.0`|`2.0.0 ~ 2.3.8`|\n\n## Features\n\n- `HMR`\n- `Friendly error message` - browser and terminal\n\n## Pre-installed\n\n- [rust](https://www.rust-lang.org/learn/get-started)\n- [nodejs](https://nodejs.org)\n- [wasm-pack](https://github.com/rustwasm/wasm-pack)\n- [rsw-rs](https://github.com/lencx/rsw-rs): `rsw = rs(rust) → w(wasm)` - A command-line tool for automatically rebuilding local changes, based on the wasm-pack implementation.\n\n## Usage\n\n### Step 1\n\nInstall rsw\n\n```bash\ncargo install rsw\n```\n\nInstall vite-plugin-rsw\n\n```bash\n# With NPM:\nnpm i -D vite-plugin-rsw\n\n# With Yarn:\nyarn add -D vite-plugin-rsw\n```\n\n### Step 2\n\nEdit vite.config.ts\n\n```js\nimport { defineConfig } from 'vite';\nimport { ViteRsw } from 'vite-plugin-rsw';\n\nexport default defineConfig({\n  plugins: [\n    ViteRsw(),\n  ],\n})\n```\n\n### Step 3\n\nEdit package.json\n\u003e recommend to use `concurrently`  instead of `\u0026` to run command concurrently, because it can't handle system signal properly, see https://github.com/rwasm/rsw-rs/issues/7\n```json5\n\"scripts\": {\n+   \"dev\": \"concurrently \\\"rsw watch\\\" \\\"vite\\\"\",\n+   \"build\": \"rsw build \u0026\u0026 tsc \u0026\u0026 vite build\",\n+   \"rsw\": \"rsw\"\n}\n```\n\n### Step 4\n\n[rsw.toml options](https://github.com/rwasm/rsw-rs#options)\n\n1. Initial rsw.toml\n\n   ```bash\n   # yarn rsw -h\n   yarn rsw init\n   ```\n\n2. Generate rust crate\n\n   ```bash\n   # rsw.toml\n   [new]\n   # using: wasm-pack | rsw | user, default is `wasm-pack`\n   using = \"wasm-pack\"\n   ```\n\n   ```bash\n   yarn rsw new rsw-hello\n   ```\n\n3. Edit rsw.toml\n\n   ```toml\n   # link type: npm | yarn | pnpm, default is `npm`\n   cli = \"npm\"\n\n   [[crates]]\n   name = \"rsw-hello\"\n   # \u003cnpm|yarn|pnpm\u003e link\n   # ⚠️ Note: must be set to `true`, default is `false`\n   link = true\n   ```\n\n### Step 5\n\nStart dev server\n\n```bash\n# rsw watch \u0026 vite\nyarn dev\n```\n\n### Step 6\n\nDeploy\n\n```bash\nyarn build\n```\n\n### Example\n\n- [WA+](https://github.com/lencx/WA) - 🤩 Making a web page more like a desktop application is just the beginning, the possibilities are unlimited, up to your imagination!\n- [Demo](https://github.com/lencx/learn-wasm) - 🎲 Learning WebAssembly\n- [Oh My Box](https://github.com/lencx/OhMyBox) - 🔮 Development toolbox, and more...\n\n## Related\n\n[create-mpl](https://github.com/lencx/create-mpl) - ⚡️ Create a project in seconds!\n\n```bash\n# Quickly initialize a wasm project\n\n# npm 6.x\nnpm init mpl@latest my-app --type wasm\n\n# npm 7+, extra double-dash is needed:\nnpm init mpl@latest my-app -- --type wasm\n```\n\n---\n\n## 微信\n\n\u003e 群二维码已过期，关注公众号《浮之静》，发送“进群”，我将拉你进群一起学习。\n\n\u003cimg height=\"180\" src=\"./assets/wasm-qrcode.png\" alt=\"wasm-wechat-qrcode\" /\u003e \u003cimg height=\"160\" src=\"./assets/fzj-qrcode.png\" alt=\"fzj-qrcode\" /\u003e\n\n## License\n\nMIT License © 2021 [lencx](https://github.com/lencx)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frwasm%2Fvite-plugin-rsw","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frwasm%2Fvite-plugin-rsw","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frwasm%2Fvite-plugin-rsw/lists"}