Cette page est affichée en anglais. Une traduction française est en cours.
ConfigsApr 11, 2026·3 min de lecture

Electron — Build Cross-Platform Desktop Apps with Web Tech

Electron is a framework for building cross-platform desktop apps with JavaScript, HTML, and CSS. Powers VS Code, Slack, Discord, Notion, Figma, GitHub Desktop, and many other household apps. Chromium + Node.js bundled together.

Introduction

Electron is a framework built by GitHub (now maintained by the OpenJS Foundation) for creating native desktop applications with web technologies. Bundles Chromium and Node.js into a single runtime, letting you ship a single codebase to Windows, macOS, and Linux.

What Electron Does

  • Main process — Node.js environment, OS APIs (filesystem, network, child processes)
  • Renderer process — Chromium window, your web app
  • IPC — bridge between main and renderer via ipcMain/ipcRenderer
  • Native menus — Menu, MenuItem, Tray, dock icon
  • Auto-updater — Squirrel-based updates
  • Notifications — native OS notifications
  • Power/clipboard/crash reporting — OS-level primitives
  • Packaging — electron-builder / electron-forge

Architecture

One main process launches one or more BrowserWindows (renderers). Chromium renders HTML; Node.js runs in main (and optionally renderer via contextIsolation). IPC messages cross the boundary. Security rule: renderer is untrusted, always validate inputs.

Self-Hosting

Package locally then distribute:

npm run build
npx electron-builder --mac --win --linux

Distribute binaries via your site or auto-update server (like Nucleus, Hazel, or GitHub Releases).

Key Features

  • Cross-platform (Win/Mac/Linux)
  • Full Node.js in main process
  • Native menus, tray, notifications
  • Auto-updater
  • Code signing support
  • Crash reporter
  • DevTools extensions
  • MAS (Mac App Store) signing
  • v28+ drops Node 18, uses ESM

Comparison

Framework Binary Size Runtime Language Memory
Electron ~150MB Chromium + Node JS ~200MB idle
Tauri ~3-10MB OS WebView + Rust Rust + JS ~80MB idle
Neutralino ~2MB OS WebView JS (no Node) ~50MB
NW.js ~150MB Chromium + Node JS ~200MB
Wails ~8MB OS WebView + Go Go + JS ~80MB

FAQ

Q: Why is the bundle so large? A: Chromium (~100MB) + Node.js (~30MB) are bundled into every app. This is the cost of cross-platform consistency.

Q: Any security concerns? A: Enable contextIsolation, disable nodeIntegration, and expose a restricted API via preload. Never execute remote code.

Q: When should I pick Tauri instead? A: Pick Tauri when you want a small footprint, performance, and the Rust ecosystem; pick Electron when you need the full Node ecosystem or strict Chromium consistency.

Sources & Credits

Discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires