docs: update

This commit is contained in:
alex8088 2022-09-19 03:09:30 +08:00
parent 9132b24751
commit da50aa9246

View file

@ -34,7 +34,8 @@
- 🚀HMR for renderer processes. - 🚀HMR for renderer processes.
- 🔥The main process and preload scripts support hot reloading. - 🔥The main process and preload scripts support hot reloading.
- 🔌Easy to debug. - 🔌Easy to debug.
- 🔋Out-of-box support for TypeScript, Vue, React, Svelte, SolidJS and more. - 🔒Compile to v8 bytecode to protect source code.
- 🔋Out-of-the-box support for TypeScript, Vue, React, Svelte, SolidJS and more.
## Usage ## Usage
@ -136,6 +137,28 @@ Add a file `.vscode/launch.json` with the following configuration:
Then, set some breakpoints in `main.ts` (source code), and start debugging in the `VSCode Debug View`. Then, set some breakpoints in `main.ts` (source code), and start debugging in the `VSCode Debug View`.
### Source Code Protection
Use the plugin `bytecodePlugin` to enable it:
```js
import { defineConfig, bytecodePlugin } from 'electron-vite'
export default defineConfig({
main: {
plugins: [bytecodePlugin()]
},
preload: {
plugins: [bytecodePlugin()]
},
renderer: {
// ...
}
})
```
`bytecodePlugin` only works in production and supports the main process and preload scripts.
### Getting Started ### Getting Started
Clone the [electron-vite-boilerplate](https://github.com/alex8088/electron-vite-boilerplate) or use the [create-electron](https://github.com/alex8088/quick-start/tree/master/packages/create-electron) tool to scaffold your project. Clone the [electron-vite-boilerplate](https://github.com/alex8088/electron-vite-boilerplate) or use the [create-electron](https://github.com/alex8088/quick-start/tree/master/packages/create-electron) tool to scaffold your project.