From 1d9be1990bc29753f345ac963eb12c430ae8e260 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8D=89=E9=9E=8B=E6=B2=A1=E5=8F=B7?= <308487730@qq.com> Date: Thu, 9 Sep 2021 10:01:48 +0800 Subject: [PATCH] chore: UPDATE --- README.md | 64 +++++++------------------------------------------------ 1 file changed, 8 insertions(+), 56 deletions(-) diff --git a/README.md b/README.md index c850409..c30d7d9 100644 --- a/README.md +++ b/README.md @@ -8,63 +8,15 @@ - npm run dev - npm run build -## Note -- In the development environment, we need to transform the `Electron` related API into commonjs -- And you can only use ESM -- So far, I've written an [vitejs-plugin-electron](https://github.com/caoxiemeihao/vitejs-plugins/tree/main/electron) plugin +## Communication +- All NodeJs、Electron API invoke passed `preload process` -## Usage -- vite.config.ts - -```ts -import { defineConfig } from 'vite' -import vue from '@vitejs/plugin-vue' -import electron from 'vitejs-plugin-electron' - -export default defineConfig((env) => ({ - plugins: [ - vue(), - electron(), - ], - // other config... -})) -``` - -> In "src/render/main.ts" file - ```ts - // You code - import { ipcRenderer } from 'electron' - import Store from 'electron-store' - - // Will be generate in development mode - const { ipcRenderer } = require("electron") - const Store = require("electron-store") - ``` - -- It works! - -- 🚀 - -- 开发模式下 Electron 相关的 API 需要转换成 commonjs -- 并且你只能用 ESM -- 为此我写了一个 [vitejs-plugin-electron](https://github.com/caoxiemeihao/vitejs-plugins/tree/main/electron) 插件 - -## electron-vue-vite-webpack -- If you're worried, you can consider using this project
- [https://github.com/caoxiemeihao/electron-vue-vite-webpack]( https://github.com/caoxiemeihao/electron-vue-vite-webpack)
- The production environment is packaged with 'webpack' - -- 🚀 - -- 如果你怕踩坑,可以考虑用这个项目
- [https://github.com/caoxiemeihao/electron-vue-vite-webpack](https://github.com/caoxiemeihao/electron-vue-vite-webpack)
- 生产环境使用 `webpack` 打包的 - ---- - -![](https://raw.githubusercontent.com/caoxiemeihao/electron-vue-vite/main/screenshot/800x600-2.png) - ---- +## Branchs +- [ant-design-vue](https://github.com/caoxiemeihao/electron-vue-vite/tree/ant-design-vue) + * [x] Use tsx + * [x] Tntegration ant-design-vue +- [with-login](https://github.com/caoxiemeihao/electron-vue-vite/tree/with-login) + * [x] With multiple BrowserWindow and tsx、ant-design-vue ## 微信讨论