Vite plugin for Lightning Web Components (LWC) providing instant preview for Salesforce component development. Current stable version is 4.1.0, released with support for Vite 6+ and @lwc/rollup-plugin 8+. This plugin handles LWC module resolution, template compilation, and HMR. Unlike @lwc/vite-plugin (experimental), this is a community-maintained production-ready alternative with full ESM support and TypeScript definitions. Release cadence follows Vite major versions.
npm install vite-plugin-lwcNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Minimal Vite configuration to enable LWC plugin. Place this in vite.config.js at project root.
Upgrade vite to ^6 and @lwc/rollup-plugin to ^8.
Use lwc({ modules: [{ dir: 'path/to/modules' }] }) in plugin options.Remove 'mode' from config and use the new boolean flags if needed.
Ensure LWC modules are compiled with @lwc/compiler >=2.0.0.
Run 'npm install vite-plugin-lwc' and ensure it's in your dependencies.
Use ESM syntax: import lwc from 'vite-plugin-lwc'.
Remove the 'mode' option from the plugin config.