{"id":26604,"library":"vite-plugin-workers-rs-unofficial","title":"vite-plugin-workers-rs-unofficial","description":"An unofficial community-maintained Vite plugin (v0.3.0) that integrates Rust worker-build with @cloudflare/vite-plugin, enabling development and deployment of Cloudflare Workers written in Rust using Vite's dev server, HMR, and build pipeline. Key differentiators: it automatically compiles Rust to WebAssembly via worker-build, handles file watching with debounce, and configures @cloudflare/vite-plugin for seamless dev and build workflows. Requires Rust toolchain, wasm32-unknown-unknown target, and worker-build CLI. Release cadence is rapid, with multiple minor versions per months.","status":"active","version":"0.3.0","language":"javascript","source_language":"en","source_url":"https://github.com/aquilacf/workers-rs","tags":["javascript","vite","vite-plugin","cloudflare","cloudflare-workers","rust","wasm","worker-build","workers-rs","typescript"],"install":[{"cmd":"npm install vite-plugin-workers-rs-unofficial","lang":"bash","label":"npm"},{"cmd":"yarn add vite-plugin-workers-rs-unofficial","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-plugin-workers-rs-unofficial","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency required for Cloudflare integration and dev server proxying.","package":"@cloudflare/vite-plugin","optional":false},{"reason":"Peer dependency; supports Vite 6, 7, and 8.","package":"vite","optional":false}],"imports":[{"note":"ESM-only package; CommonJS require is not supported.","wrong":"const cloudflareRustWorker = require('vite-plugin-workers-rs-unofficial')","symbol":"cloudflareRustWorker","correct":"import { cloudflareRustWorker } from 'vite-plugin-workers-rs-unofficial'"}],"quickstart":{"code":"// vite.config.ts\nimport { defineConfig } from 'vite';\nimport { cloudflareRustWorker } from 'vite-plugin-workers-rs-unofficial';\n\nexport default defineConfig({\n  plugins: [cloudflareRustWorker()],\n  environments: {\n    worker: {\n      consumer: 'server',\n      build: { outDir: 'dist/worker', emptyOutDir: false },\n    },\n  },\n});","lang":"typescript","description":"This config sets up the Rust worker plugin with Vite, specifying the worker environment and build output directory."},"warnings":[{"fix":"Ensure `rustBuild.outDir` (default 'build') matches wrangler.jsonc's `main` directory.","message":"The `outDir` option in `rustBuild` must match the directory specified in `wrangler.jsonc` `main` field.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Review the plugin source and verify compatibility with your Cloudflare Workers setup.","message":"The plugin is unofficial and not affiliated with Cloudflare. No official support or guarantees.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Adjust `debounceMs` and `maxRetries` options to reduce unnecessary restarts.","message":"During development, the plugin restarts the Vite dev server after each successful rebuild, which may cause brief interruptions.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"search_vec":"'automat':45 'build':20,40,53,66,79,104 'cadenc':82 'cli':80 'cloudflar':28,96,98 'cloudflare-work':97 'cloudflare/vite-plugin':22,61 'communiti':10 'community-maintain':9 'compil':46 'configur':60 'debounc':58 'deploy':26 'dev':36,64 'develop':24 'differenti':43 'enabl':23 'file':55 'handl':54 'hmr':38 'integr':16 'javascript':91 'key':42 'maintain':11 'minor':87 'month':90 'multipl':86 'per':89 'pipelin':41 'plugin':3,13,95 'rapid':84 'releas':81 'requir':68 'rs':5,107 'rust':17,32,47,69,100 'seamless':63 'server':37 'target':75 'toolchain':70 'typescript':108 'unknown':73,74 'unoffici':6,8 'use':33 'v0.3.0':14 'version':88 'via':50 'vite':2,12,34,92,94 'vite-plugin':93 'vite-plugin-workers-rs-unoffici':1 'wasm':101 'wasm32':72 'wasm32-unknown-unknown':71 'watch':56 'webassembl':49 'worker':4,19,29,52,78,99,103,106 'worker-build':18,51,77,102 'workers-r':105 'workflow':67 'written':30","created_at":"2026-05-01T13:50:50.559396+00:00","updated_at":"2026-05-01T13:50:50.559396+00:00","problems":[{"fix":"Run `npm install -D vite-plugin-workers-rs-unofficial` or ensure it is in package.json devDependencies.","cause":"Package not installed or missing from node_modules.","error":"Error: Cannot find module 'vite-plugin-workers-rs-unofficial'"},{"fix":"Change `const { cloudflareRustWorker } = require(...)` to `import { cloudflareRustWorker } from 'vite-plugin-workers-rs-unofficial'`.","cause":"Using CommonJS `require` instead of ESM import.","error":"TypeError: (0 , vite_plugin_workers_rs_unofficial.cloudflareRustWorker) is not a function"},{"fix":"Install worker-build: `cargo install worker-build` and ensure it is on your PATH.","cause":"The `worker-build` CLI is not installed or not in PATH.","error":"Error: worker-build not found. Install with `cargo install worker-build`"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/aquilacf/workers-rs","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/vite-plugin-workers-rs-unofficial","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops","web-framework"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-05-01","next_check":"2026-07-30","install_tag":null}}