{"id":42235,"library":"vite-plugin-lwc","title":"Vite Plugin for Lightning Web Components (LWC)","description":"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.","status":"active","version":"4.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/cardoso/vite-plugin-lwc","tags":["javascript","vite-plugin","lwc","lightning","web","components","typescript"],"install":[{"cmd":"npm install vite-plugin-lwc","lang":"bash","label":"npm"},{"cmd":"yarn add vite-plugin-lwc","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-plugin-lwc","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core LWC compilation logic delegation","package":"@lwc/rollup-plugin","optional":false},{"reason":"Peer dependency for Vite plugin ecosystem","package":"vite","optional":false}],"imports":[{"note":"ESM-only plugin. CJS require() will fail because the package only exports a default ESM function.","wrong":"const lwc = require('vite-plugin-lwc')","symbol":"default","correct":"import lwc from 'vite-plugin-lwc'"},{"note":"Options type is only available as a type import to avoid runtime inclusion. Not exported as value.","wrong":"import { LwcPluginOptions } from 'vite-plugin-lwc'","symbol":"lwc type","correct":"import type { LwcPluginOptions } from 'vite-plugin-lwc'"},{"note":"The plugin is a factory function, not a class. Do not use 'new'.","wrong":"new lwc()","symbol":"Plugin registration","correct":"lwc()"}],"quickstart":{"code":"// vite.config.js\nimport { defineConfig } from 'vite';\nimport lwc from 'vite-plugin-lwc';\n\nexport default defineConfig({\n  plugins: [lwc()],\n});","lang":"javascript","description":"Minimal Vite configuration to enable LWC plugin. Place this in vite.config.js at project root."},"warnings":[{"fix":"Upgrade vite to ^6 and @lwc/rollup-plugin to ^8.","message":"Version 4.0.0 drops support for Vite 5 and @lwc/rollup-plugin 7. Update your peer dependencies to Vite >=6 and @lwc/rollup-plugin >=8.","severity":"breaking","affected_versions":"<4.0.0"},{"fix":"Use lwc({ modules: [{ dir: 'path/to/modules' }] }) in plugin options.","message":"The plugin expects LWC modules to be under 'src/modules' by default. If your project uses a different directory, you must configure it via options.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Remove 'mode' from config and use the new boolean flags if needed.","message":"The 'mode' option was removed in v3. Use 'ssr' and 'client' options instead.","severity":"deprecated","affected_versions":">=3.0.0"},{"fix":"Ensure LWC modules are compiled with @lwc/compiler >=2.0.0.","message":"HMR requires the LWC compiler to output compatible code. Some older LWC components may not support HMR and require a full reload.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'4.1.0':26 '6':32 '8':35 'altern':58 'cadenc':67 'communiti':53 'community-maintain':52 'compil':43 'compon':6,13,20,79 'current':22 'definit':65 'develop':21 'esm':61 'experiment':48 'follow':68 'full':60 'handl':38 'hmr':45 'instant':16 'javascript':72 'lightn':4,11,77 'lwc':7,14,39,76 'lwc/rollup-plugin':34 'lwc/vite-plugin':47 'maintain':54 'major':70 'modul':40 'plugin':2,9,37,75 'preview':17 'product':56 'production-readi':55 'provid':15 'readi':57 'releas':27,66 'resolut':41 'salesforc':19 'stabl':23 'support':29,62 'templat':42 'typescript':64,80 'unlik':46 'version':24,71 'vite':1,8,31,69,74 'vite-plugin':73 'web':5,12,78","created_at":"2026-06-04T18:56:16.682380+00:00","updated_at":"2026-06-04T18:56:16.682380+00:00","problems":[{"fix":"Run 'npm install vite-plugin-lwc' and ensure it's in your dependencies.","cause":"Package not installed or missing from package.json dependencies.","error":"Error: Cannot find module 'vite-plugin-lwc'"},{"fix":"Use ESM syntax: import lwc from 'vite-plugin-lwc'.","cause":"Using default import incorrectly or CJS require() in an ESM-only package.","error":"TypeError: lwc is not a function"},{"fix":"Remove the 'mode' option from the plugin config.","cause":"Using deprecated 'mode' option that was removed in v3.","error":"[vite] Internal server error: Unknown plugin option 'mode'"}],"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/cardoso/vite-plugin-lwc/tree/main/packages/vite-plugin-lwc#readme","github":"https://github.com/cardoso/vite-plugin-lwc","docs":null,"changelog":null,"pypi":null,"npm":"vite-plugin-lwc","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}}