docs: update

This commit is contained in:
alex8088 2022-09-11 16:54:48 +08:00
parent 714798fd56
commit 2132eccb28

View file

@ -27,11 +27,13 @@
## Features ## Features
- ⚡️ Inherit all the benefits of Vite and use the same way as [Vite](https://vitejs.dev). - ⚡️ Inherit all the benefits of Vite and use the same way as [Vite](https://vitejs.dev).
- 📦The main process, renderers and preload scripts are all built with Vite. - 📦The main process, renderers and preload scripts are all built with Vite.
- 🛠The main process, renderers and preload scripts Vite configuration combined into one file. - 🛠The main process, renderers and preload scripts Vite configuration combined into one file.
- 💡Pre-configured for Electron, don't worry about configuration. - 💡Pre-configured for Electron, don't worry about configuration.
- 🚀HMR for renderer processes. - 🚀HMR for renderer processes.
- 🔥The main process and preload scripts support hot reloading.
- 🔌Easy to debug
## Usage ## Usage
@ -98,6 +100,16 @@ function createWindow() {
} }
``` ```
### Hot Reloading
Hot reloading refers to quickly rebuilding and restarting the Electron app when the main process or preload scripts module changes. In fact, it's not really hot reloading, but similar. It also brings a good development experience to developers.
There are two ways to enable it:
1. Use CLI option `-w` or `--watch`, e.g. `electron-vite dev --watch`. This is the preferred way, it's more flexible.
2. Use configuration option `build.watch` and set to `{}`. In addition, more watcher options can be configured, see [WatcherOptions](https://rollupjs.org/guide/en/#watch-options).
### Debugging in VSCode ### Debugging in VSCode
Add a file `.vscode/launch.json` with the following configuration: Add a file `.vscode/launch.json` with the following configuration: