• English
  • Migrate from electron-vite

    Rselectron aims for capability parity, not drop-in Vite config renaming. Migrate by semantics. Known parity exceptions (Vite plugins, V8 bytecode, exported SWC helpers) are summarized under Compatibility.

    Packages and plugins

    electron-viteRselectron
    electron-vite package@rselectron/core (peer: @rsbuild/core)
    Vite pluginsException — rewrite as Rsbuild / Rspack plugins
    Bytecode plugin / V8 bytecodeException — not implemented; no silent fallback
    Exported SWC helpersException — configure SWC via Rsbuild / Rspack

    Config and environment

    TopicMapping
    Main / Preload / Renderer Vite configsmain / preload / renderer under defineConfig (Rsbuild) — Configuration
    Vite root / build / pluginsRsbuild root / output / plugins
    Environment files--env-mode plus RSELECTRON_ prefixes — Environment
    Build mode--mode (development | production | none)
    Electron launch optionsTop-level electronElectron options

    Watch and development

    electron-viteRselectron
    Main / Preload watchelectron.watch or rselectron dev --watch[=main|preload]CLI
    Renderer HMRRenderer development server (Vanilla / React via Rsbuild plugins)
    Config changeReload config and replace the development session

    API and CLI

    SurfaceNotes
    CLIExplicit dev / build / preview / inspect; long flags kebab-case only — CLI
    Programmatic APIbuild, createServer, preview, inspect, defineConfig, and related exports — JavaScript API
    Electron versionsELECTRON_SUPPORT_SNAPSHOT and the optional Electron peer
    Packaging boundarySource builds only; use electron-builder / Forge for installers

    Checklist

    1. Replace Vite plugins with Rsbuild plugins.
    2. Remove bytecode / SWC-helper usage; handle remaining needs outside Rselectron if required.
    3. Map each process root and entry to Rsbuild config under Configuration.
    4. Point package.json#main at the planned Main output under Conventional role outputs (out/main/... when distPath is unset).
    5. Prefer the Preferred ESM path for "type": "module" apps: leave electron.format at auto (derived ESM). Drop beta CJS workarounds—forced format: 'cjs', externalizeDeps.include lists added only for import-only packages, and default webpackIgnore / magic-comment import() interop—once on ESM (Troubleshooting).
    6. Install project-local Electron within the supported peer range (Compatibility).
    7. Validate with rselectron inspect, then run dev / build / preview.
    8. Prefer copying from examples/.