Electron plugin for Vite
- 🏠Presets for main process:
- target:
node*, automatically match node target ofElectron. For example, the node target of Electron 17 isnode16.13 - lib.entry:
{index|main}.{js|ts|mjs|cjs}(relative to root from vite config file), empty string if not found - lib.formats:
cjs - rollupOptions.external:
electronand all builtin modules, and it will merge automatically with the external module ids added by user
- target:
- 🔗Presets for preload script:
- target: the same as
main - lib.entry:
{index|preload}.{js|ts|mjs|cjs}(relative to root from vite config file), empty string if not found - lib.formats:
cjs - rollupOptions.external: the same as
main
- target: the same as
- 🌴Presets for renderer process:
- target:
chrome*, automatically match chrome target ofElectron. For example, the chrome target of Electron 17 ischrome98 - polyfillModulePreload:
false, there is no need to polyfillModule Preloadfor the Electron renderer - rollupOptions.external: the same as
main
- target:
- 🔧Resolved config checking
npm i vite-plugin-electron-config -Dimport { defineConfig } from 'vite'
import { electronMain } from 'vite-plugin-electron-config'
export default defineConfig({
plugins: [electronMain()]
})import { defineConfig } from 'vite'
import { electronPreload } from 'vite-plugin-electron-config'
export default defineConfig({
plugins: [electronPreload()]
})import { defineConfig } from 'vite'
import { electronRenderer } from 'vite-plugin-electron-config'
export default defineConfig({
plugins: [electronRenderer()]
})electron-vite, an Electron CLI integrated with Vite, make you easy to use Vite.
MIT License © 2022 Alex Wei