electron-vite

Next generation Electron build tooling based on Vite 新一代 Electron 开发构建工具,支持...

README

electron-vite


Next generation Electron build tooling based on Vite

Features


- ⚡️ Vite powered and use the same way.
- 🛠 Pre-configured for Electron, don't worry about configuration.
- 💡 Optimize asset handling (Node.js addons, WebAssembly, Worker Thread, etc).
- 🚀 Fast HMR for renderer processes.
- 🔥 Hot reloading for main process and preload scripts.
- 🔌 Easy to debug in IDEs like VSCode or WebStorm.
- 🔒 Compile to v8 bytecode to protect source code.
- 🏷️ Support for TypeScript decorators.
- 📦 Out-of-the-box support for TypeScript, Vue, React, Svelte, SolidJS and more.

Usage


Install


  1. ```sh
  2. npm i electron-vite -D
  3. ```

Development & Build


In a project where electron-vite is installed, you can use electron-vite binary directly with npx electron-vite or add the npm scripts to your package.json file like this:

  1. ```json
  2. {
  3.   "scripts": {
  4.     "start": "electron-vite preview",
  5.     "dev": "electron-vite dev",
  6.     "prebuild": "electron-vite build"
  7.   }
  8. }
  9. ```

Configuration


When running electron-vite from the command line, electron-vite will automatically try to resolve a config file named electron.vite.config.js inside project root. The most basic config file looks like this:

  1. ```js
  2. // electron.vite.config.js
  3. export default {
  4.   main: {
  5.     // vite config options
  6.   },
  7.   preload: {
  8.     // vite config options
  9.   },
  10.   renderer: {
  11.     // vite config options
  12.   }
  13. }
  14. ```

Getting Started


Clone the electron-vite-boilerplate or use the create-electron tool to scaffold your project.

  1. ```bash
  2. npm create @quick-start/electron
  3. ```

Currently supported template presets include:

License


MIT © alex.wei