vue-cli-plugin-electron-builder is a powerful Vue CLI plugin designed to simplify the integration of Electron into Vue.js projects, enabling the creation of cross-platform desktop applications. It acts as a bridge between Vue CLI and electron-builder, handling the complex setup of Electron's main and renderer processes, including webpack configuration, hot-reloading during development, and packaging for distribution. The current stable version is 2.1.1, with a significant v3.0.0-alpha.0 release introducing updates to dependencies and a shift from Spectron to Playwright for testing. The plugin's release cadence generally aligns with major updates to Electron and Vue CLI. Key differentiators include its deep integration into the Vue CLI ecosystem, providing a familiar development experience for Vue developers, and its robust support for features like Node.js integration (configurable) and multi-page Electron applications.
npm install vue-cli-plugin-electron-builderVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to install the plugin, configure essential Electron Builder options within `vue.config.js` (including critical `nodeIntegration` and builder-specific settings), and run/build the Electron application using Vue CLI commands.
To re-enable Node.js integration for your renderer processes, add `nodeIntegration: true` under `pluginOptions.electronBuilder` in your `vue.config.js`. For more secure access, consider using preload scripts to expose specific, controlled APIs.
Update your testing utilities to explicitly pass `spectron` to `testWithSpectron`. Ensure your Jest configuration (e.g., `jest.config.js`) includes `testEnvironment: "node"` for tests involving Electron environments.
Migrate any custom Devtools installation logic to directly use the `electron-devtools-installer` package for better compatibility and feature support.
If upgrading to v3, refactor your testing suite to utilize Playwright's Electron API. Consult Playwright's official documentation for guidance on testing Electron applications.
Check the plugin's GitHub issues or release notes for known Devtools compatibility problems with your Electron version. You might need to downgrade Electron or manually troubleshoot Devtools installation.
Ensure you are using a stable v2.x release or a release candidate that has addressed this bug. Verify your asset paths and `vue.config.js` for any `BASE_URL` related misconfigurations.
To re-enable Node.js integration, add `nodeIntegration: true` to `pluginOptions.electronBuilder` in your `vue.config.js`. For a more secure approach, use a preload script to expose specific Node.js APIs to the renderer.
Update your test calls to `testWithSpectron(require('spectron'), /* ...your args */)` or `testWithSpectron(spectron, /* ...your args */)` if `spectron` is imported.For main process specific webpack adjustments, utilize options like `chainWebpackMainProcess` or `mainProcessTypeChecking` within `pluginOptions.electronBuilder` in your `vue.config.js`.
Verify that your Electron version is compatible with Vue Devtools. Ensure `electron-devtools-installer` is correctly configured and that no deprecated `installVueDevtools` function is being called.
Ensure you are using a stable v2.x release. Review your `vue.config.js` for any `BASE_URL` overrides and confirm that paths to static assets are correctly specified relative to the `public` folder.