Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:777genius Agent teams ai electron vite build

From Leeroopedia
Knowledge Sources
Domains Release, Build
Last Updated 2026-10-22 00:00 GMT

Overview

Concrete tool for building the Electron application with three process targets using electron-vite, provided by the Agent Teams application.

Description

The pnpm build command runs electron-vite to compile the source tree into production bundles for three Electron process targets. The `electron.vite.config.ts` file configures each target with its entry point, TypeScript path aliases, and build options.

Key configuration:

  • Three targets: Main process (`src/main/index.ts`), preload bridge (`src/preload/index.ts`), renderer (`src/renderer/index.html`).
  • Path aliases: `@main/*`, `@renderer/*`, `@shared/*`, `@preload/*` resolved by Vite config.
  • Tailwind CSS: PostCSS with Tailwind processes the renderer's CSS.
  • Source maps: Sentry source map generation configured for production.
  • Output: Compiled bundles in `out/main/`, `out/preload/`, `out/renderer/`.
  • TypeScript path aliases: Configured in `tsconfig.json` and mapped in `electron.vite.config.ts`.

Usage

  • Production build: Run `pnpm build` before packaging.
  • Dev mode: Run `pnpm dev` for hot-reload development (uses electron-vite dev server).

Code Reference

Source Location

Signature

// electron.vite.config.ts (simplified structure)
export default defineConfig({
  main: {
    build: { rollupOptions: { input: 'src/main/index.ts' } },
    resolve: { alias: { '@main': '/src/main', '@shared': '/src/shared' } }
  },
  preload: {
    build: { rollupOptions: { input: 'src/preload/index.ts' } },
    resolve: { alias: { '@preload': '/src/preload', '@shared': '/src/shared' } }
  },
  renderer: {
    root: 'src/renderer',
    build: { rollupOptions: { input: 'src/renderer/index.html' } },
    resolve: { alias: { '@renderer': '/src/renderer', '@shared': '/src/shared' } },
    plugins: [react(), tailwindcss()]
  }
});

Import

# Run via pnpm script
pnpm build

I/O Contract

Inputs

Name Type Required Description
src/main/ directory Yes Main process source files
src/preload/ directory Yes Preload bridge source files
src/renderer/ directory Yes Renderer source files (React, HTML, CSS)
electron.vite.config.ts config Yes Build configuration

Outputs

Name Type Description
out/main/ directory Compiled main process bundle
out/preload/ directory Compiled preload bridge bundle
out/renderer/ directory Compiled renderer bundle (HTML, JS, CSS)

Usage Examples

Production Build

# Build all three targets
pnpm build

# Output:
# out/main/index.js
# out/preload/index.js
# out/renderer/index.html + assets/

Dev Mode with Hot Reload

# Start dev server with hot reload
pnpm dev

# electron-vite dev server provides:
# - HMR for renderer
# - Auto-restart for main/preload on changes

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment