From da50aa9246705c0efef13bf424f5cb871edc1611 Mon Sep 17 00:00:00 2001 From: alex8088 <244096523@qq.com> Date: Mon, 19 Sep 2022 03:09:30 +0800 Subject: [PATCH] docs: update --- README.md | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e3f2764..e2e4688 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,8 @@ - 🚀HMR for renderer processes. - 🔥The main process and preload scripts support hot reloading. - 🔌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 @@ -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`. +### 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 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.