Convert Figma logo to code with AI

nklayman logovue-cli-plugin-electron-builder

Easily Build Your Vue.js App For Desktop With Electron

4,118
278
4,118
76

Top Related Projects

6,445

:electron: A complete tool for building and publishing Electron applications

A Foundation for Scalable Cross-Platform Apps

An Electron & Vue.js quick start boilerplate with vue-cli scaffolding, common Vue plugins, electron-packager/electron-builder, unit/e2e testing, vue-devtools, and webpack.

Clone to try a simple Electron app

🥳 Really simple Electron + Vite + Vue boilerplate.

83,441

Build smaller, faster, and more secure desktop and mobile applications with a web frontend.

Quick Overview

Vue CLI Plugin Electron Builder is a plugin for Vue CLI that simplifies the process of creating Electron applications with Vue.js. It integrates Electron Builder into Vue CLI projects, allowing developers to build and package Electron apps using familiar Vue CLI commands.

Pros

  • Seamless integration with Vue CLI projects
  • Simplifies the setup and configuration of Electron in Vue applications
  • Provides easy-to-use commands for development, building, and packaging
  • Supports TypeScript out of the box

Cons

  • Limited to Vue.js projects using Vue CLI
  • May require additional configuration for complex Electron features
  • Learning curve for developers new to Electron
  • Potential version conflicts between Vue CLI and Electron dependencies

Code Examples

  1. Installing the plugin:
vue add electron-builder
  1. Running the app in development mode:
npm run electron:serve
  1. Building and packaging the app for production:
npm run electron:build
  1. Configuring Electron Builder options in vue.config.js:
module.exports = {
  pluginOptions: {
    electronBuilder: {
      builderOptions: {
        // Configure electron-builder options here
        appId: 'com.example.app',
        productName: 'My Electron App'
      }
    }
  }
}

Getting Started

  1. Create a new Vue CLI project:

    vue create my-electron-app
    cd my-electron-app
    
  2. Add the Electron Builder plugin:

    vue add electron-builder
    
  3. Run the app in development mode:

    npm run electron:serve
    
  4. Build and package the app for production:

    npm run electron:build
    

These steps will set up a basic Electron app using Vue CLI and the Electron Builder plugin. You can then start developing your Electron application using Vue.js components and features.

Competitor Comparisons

6,445

:electron: A complete tool for building and publishing Electron applications

Pros of Electron Forge

  • More comprehensive toolset for Electron app development, including boilerplate generation and publishing
  • Official Electron tool with better long-term support and integration
  • Supports multiple frontend frameworks, not limited to Vue.js

Cons of Electron Forge

  • Steeper learning curve for developers already familiar with Vue CLI
  • May require more configuration for Vue.js projects compared to a Vue-specific plugin
  • Less seamless integration with existing Vue CLI projects

Code Comparison

vue-cli-plugin-electron-builder:

module.exports = {
  pluginOptions: {
    electronBuilder: {
      builderOptions: {
        // Configure electron-builder options here
      }
    }
  }
}

Electron Forge:

module.exports = {
  packagerConfig: {},
  makers: [
    {
      name: '@electron-forge/maker-squirrel',
      config: {
        // Configure maker options here
      }
    }
  ]
}

Summary

Electron Forge offers a more comprehensive and flexible solution for Electron app development, supporting multiple frameworks and providing extensive tooling. However, vue-cli-plugin-electron-builder excels in its seamless integration with Vue CLI projects and simplicity for Vue.js developers. The choice between the two depends on project requirements, team expertise, and desired level of customization.

A Foundation for Scalable Cross-Platform Apps

Pros of electron-react-boilerplate

  • Comprehensive boilerplate with a full-featured development environment
  • Includes hot-reloading and ready-to-use testing setup
  • Actively maintained with frequent updates and a large community

Cons of electron-react-boilerplate

  • Steeper learning curve due to its extensive configuration
  • Less flexibility for customization as it's a full boilerplate
  • Potentially includes unnecessary features for simpler projects

Code Comparison

electron-react-boilerplate:

import { app, BrowserWindow, shell, ipcMain } from 'electron';
import { autoUpdater } from 'electron-updater';
import log from 'electron-log';
import MenuBuilder from './menu';
import { resolveHtmlPath } from './util';

vue-cli-plugin-electron-builder:

const { app, BrowserWindow } = require('electron');
const path = require('path');

function createWindow() {
  const win = new BrowserWindow({
    width: 800,
    height: 600,
    webPreferences: {
      nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION,
      contextIsolation: !process.env.ELECTRON_NODE_INTEGRATION
    }
  });

The code snippets show that electron-react-boilerplate includes more built-in features like auto-updating and logging, while vue-cli-plugin-electron-builder provides a simpler setup focused on creating the main window. This reflects the overall difference in approach between the two projects, with electron-react-boilerplate offering a more comprehensive out-of-the-box solution and vue-cli-plugin-electron-builder providing a more flexible, Vue-centric option.

An Electron & Vue.js quick start boilerplate with vue-cli scaffolding, common Vue plugins, electron-packager/electron-builder, unit/e2e testing, vue-devtools, and webpack.

Pros of electron-vue

  • Provides a complete boilerplate with a pre-configured project structure
  • Includes vue-devtools out of the box for easier debugging
  • Offers a more opinionated setup, which can be beneficial for beginners

Cons of electron-vue

  • Less flexible and harder to customize compared to vue-cli-plugin-electron-builder
  • Not actively maintained, with fewer recent updates and potential compatibility issues
  • Requires more setup and configuration for modern Vue.js features

Code Comparison

electron-vue (main process):

import { app, BrowserWindow } from 'electron'

let mainWindow
app.on('ready', () => {
  mainWindow = new BrowserWindow({width: 800, height: 600})
  mainWindow.loadURL(`file://${__dirname}/index.html`)
})

vue-cli-plugin-electron-builder (background.js):

import { app, protocol, BrowserWindow } from 'electron'
import { createProtocol } from 'vue-cli-plugin-electron-builder/lib'

let win
function createWindow() {
  win = new BrowserWindow({ width: 800, height: 600, webPreferences: { nodeIntegration: true } })
  if (process.env.WEBPACK_DEV_SERVER_URL) win.loadURL(process.env.WEBPACK_DEV_SERVER_URL)
  else {
    createProtocol('app')
    win.loadURL('app://./index.html')
  }
}
app.on('ready', createWindow)

The code comparison shows that vue-cli-plugin-electron-builder offers a more modern approach with better integration of development and production environments, while electron-vue provides a simpler setup but with less flexibility.

Clone to try a simple Electron app

Pros of electron-quick-start

  • Simple and straightforward setup for beginners
  • Minimal boilerplate code, making it easier to understand the basics
  • Provides a clean slate for custom Electron app development

Cons of electron-quick-start

  • Lacks integration with modern front-end frameworks like Vue.js
  • Requires manual setup for build processes and packaging
  • Limited out-of-the-box features for production-ready applications

Code Comparison

electron-quick-start:

const { app, BrowserWindow } = require('electron')

function createWindow () {
  const win = new BrowserWindow({ width: 800, height: 600 })
  win.loadFile('index.html')
}

app.whenReady().then(createWindow)

vue-cli-plugin-electron-builder:

import { createApp } from 'vue'
import App from './App.vue'
import { createElectronApp } from 'vue-cli-plugin-electron-builder'

createApp(App).mount('#app')

createElectronApp()

The electron-quick-start code shows a basic Electron setup, while vue-cli-plugin-electron-builder integrates Vue.js and provides a more structured approach for building Electron apps with Vue. The latter offers a higher level of abstraction and easier integration with the Vue ecosystem, making it more suitable for complex applications. However, electron-quick-start provides a simpler starting point for those who want to learn Electron basics or build custom solutions from scratch.

🥳 Really simple Electron + Vite + Vue boilerplate.

Pros of electron-vite-vue

  • Faster build times due to Vite's efficient bundling and hot module replacement
  • Better TypeScript support out of the box
  • More modern and lightweight setup, with less configuration required

Cons of electron-vite-vue

  • Less mature and potentially less stable compared to vue-cli-plugin-electron-builder
  • Smaller community and fewer resources available for troubleshooting
  • May require more manual setup for certain advanced features

Code Comparison

vue-cli-plugin-electron-builder:

module.exports = {
  pluginOptions: {
    electronBuilder: {
      builderOptions: {
        // Configure electron-builder options here
      }
    }
  }
}

electron-vite-vue:

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import electron from 'vite-plugin-electron'

export default defineConfig({
  plugins: [vue(), electron()]
})

The code comparison shows that electron-vite-vue has a simpler configuration setup, leveraging Vite's plugin system. vue-cli-plugin-electron-builder uses Vue CLI's configuration structure, which may be more familiar to developers already using Vue CLI.

Both projects aim to simplify Electron development with Vue, but electron-vite-vue focuses on modern, fast tooling with Vite, while vue-cli-plugin-electron-builder provides a more established ecosystem within the Vue CLI environment.

83,441

Build smaller, faster, and more secure desktop and mobile applications with a web frontend.

Pros of Tauri

  • Smaller bundle sizes and better performance due to native system APIs
  • Cross-platform support for mobile (iOS and Android) in addition to desktop
  • Enhanced security with a rust-based backend

Cons of Tauri

  • Steeper learning curve, especially for developers unfamiliar with Rust
  • Less mature ecosystem compared to Electron-based solutions
  • Limited access to certain native APIs that Electron provides

Code Comparison

vue-cli-plugin-electron-builder:

const { app, BrowserWindow } = require('electron')

function createWindow () {
  const win = new BrowserWindow({ width: 800, height: 600 })
  win.loadFile('index.html')
}

app.whenReady().then(createWindow)

Tauri:

#![cfg_attr(
  all(not(debug_assertions), target_os = "windows"),
  windows_subsystem = "windows"
)]

fn main() {
  tauri::Builder::default()
    .run(tauri::generate_context!())
    .expect("error while running tauri application");
}

The vue-cli-plugin-electron-builder uses JavaScript and Electron's APIs, while Tauri uses Rust for its core functionality. Tauri's approach results in smaller binaries and potentially better performance, but may require more setup and learning for developers new to Rust.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Vue CLI Plugin Electron Builder

Easily Build Your Vue.js App For Desktop With Electron

Build status: Build status

Sponsor

Top Supporters

Glenn Frank
Glenn Frank

Quick Start:

Open a terminal in the directory of your app created with Vue-CLI 3 or 4 (4 is recommended).

Then, install and invoke the generator of vue-cli-plugin-electron-builder by running:

vue add electron-builder

That's It! You're ready to go!

To start a development server:

If you use Yarn:

yarn electron:serve

or if you use NPM:

npm run electron:serve

To build your app:

With Yarn:

yarn electron:build

or with NPM:

npm run electron:build

To see more documentation, visit our website.

Supporters

Yves HoppedurairajasivamAlec ArmbrusterTilen HosnarAndrew LeTourneau
Yves HoppedurairajasivamAlec ArmbrusterTilen HosnarAndrew LeTourneau
Kalila LakeworthEric SchirtzingerKarim HossenbuxDecentralized Justice
Kalila LakeworthEric SchirtzingerKarim HossenbuxDecentralized Justice

Past Supporters

Mitch DennetChris Hayes
Mary-Tyler-MooreMitch DennetChris Hayes

NPM DownloadsLast 30 Days