Principle:777genius Agent teams ai Electron Build
| Knowledge Sources | |
|---|---|
| Domains | Release, Build |
| Last Updated | 2026-10-22 00:00 GMT |
Overview
Pattern for building an Electron application with three targets (main, preload, renderer) using electron-vite with TypeScript path aliases, Tailwind CSS, and source map generation.
Description
Electron Build is the process of compiling the source tree into production bundles for the three Electron process targets. The `electron.vite.config.ts` file configures each target with its entry point, path aliases, and build options.
Key aspects:
- Three targets: Main process (`src/main/`), preload bridge (`src/preload/`), and renderer (`src/renderer/`) each get separate Vite build configurations.
- Path aliases: `@main/*`, `@renderer/*`, `@shared/*`, `@preload/*`, `@features/*` are resolved by the Vite config.
- Tailwind CSS: PostCSS with Tailwind processes the renderer's CSS.
- Source maps: Sentry source map generation is configured for production builds.
- Output directories: Compiled bundles go to `out/main/`, `out/preload/`, `out/renderer/`.
- TypeScript: The build uses TypeScript for type checking; `tsc` runs before the Vite build.
Usage
Use this principle when building a multi-process Electron application with Vite, especially when path aliases, CSS preprocessing, and source map generation are needed.