Skip to content

Repository files navigation

Rselectron Banner

Rselectron

documentation npm version node version license

English | 简体中文

Rselectron is an Rspack-first Electron development and build tool. Develop and source-build Electron apps with Rsbuild and Rspack.

Features

  • ⚡️ Rsbuild / Rspack powered, with Electron-oriented defaults
  • 🛠 Single config for main, preload, and renderer
  • 🚀 Fast builds with Rust-based parallel compilation
  • 🔥 Renderer HMR, plus hot reload for main and preload
  • 💡 Asset handling tuned for the Electron main process
  • ✨ Isolated builds for multi-entry Electron apps
  • 🔌 Framework agnostic — use any UI stack your Rsbuild setup supports
  • 📦 Out-of-the-box TypeScript support, plus inspect for debugging config

Usage

Install

npm i @rselectron/core @rsbuild/core -D

@rsbuild/core is a required project peer (npm 7+ / pnpm 8+ install it automatically). Rselectron warns — never blocks — when the installed Rsbuild minor is outside the release's tested window.

Development & Build

Add npm scripts to your package.json:

{
  "scripts": {
    "dev": "rselectron dev",
    "build": "rselectron build",
    "preview": "rselectron preview"
  }
}

Configuration

When you run the CLI, Rselectron resolves a config file at the project root (for example rselectron.config.ts). A minimal config looks like this:

import { defineConfig } from '@rselectron/core';

export default defineConfig({
  main: {
    root: './src/main',
    source: { entry: { index: './index.ts' } },
  },
  preload: {
    root: './src/preload',
    source: { entry: { index: './index.ts' } },
  },
  renderer: {
    root: './src/renderer',
    source: { entry: { index: './index.ts' } },
  },
});

Each of main / preload / renderer is a full Rsbuild config. See the configuration guide for details.

Getting Started

Start from a learning example in this repository:

Example Description
vanilla Minimal Main / Preload / Renderer app
react React renderer with @rsbuild/plugin-react
cd examples/vanilla
pnpm install
pnpm dev

Full walkthrough: Getting Started.

About

Rselectron is an Rspack-first Electron development and build tool. Rselectron 是基于 Rspack 的 Electron 应用开发与构建工具。

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages