High-performance Vite plugin for Electron development (v0.8.3). Uses esbuild under the hood for fast transforms, supports hot restart and plugin system similar to Vite's own plugin API. Unlike electron-vite, this plugin integrates into an existing Vite config rather than requiring a separate Vite config for Electron. Active development with frequent releases. Ships TypeScript types. Peer dependencies: acorn, esbuild.
npm install vite-electron-pluginVerified import paths — ran on the pinned version, not inferred.
Sets up vite-electron-plugin in a Vite config and creates a basic Electron main process entry.
Update all imports from 'vite-plugin-electron' to 'vite-electron-plugin'.
Use relative paths (e.g., 'electron') or absolute paths that are subdirectories of root.
Remove 'api' from config and use plugin hooks to pass data.
Ensure Electron main code checks process.env.VITE_DEV_SERVER_URL and loads the appropriate URL or file path.
Name preload scripts or other renderer-only files with the '.reload.extension' pattern to optimize development.
Run: npm install vite-electron-plugin acorn esbuild
Add include: ['electron'] (or your Electron source directory) to the plugin options.
Use: import electron from 'vite-electron-plugin' (not import { electron } from ...)Use a relative path for outDir, e.g., 'dist-electron', or ensure absolute path is inside root.