From a91a506289d572445fd557baa1307ce875318a0e 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: Wed, 20 Jul 2022 08:19:21 +0800 Subject: [PATCH 1/2] chore(deps): bump vite-plugin-electron to 0.8.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ba369314..91b8904c 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "electron-builder": "^23.1.0", "typescript": "^4.7.4", "vite": "^2.9.13", - "vite-plugin-electron": "^0.7.5", + "vite-plugin-electron": "^0.8.0", "vue": "^3.2.37", "vue-tsc": "^0.38.3" }, From 2fb947710683e6d0f9e2172970c9ae3dcae6ab5a 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: Wed, 20 Jul 2022 08:47:41 +0800 Subject: [PATCH 2/2] docs: update --- README.md | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 665b21ee..fcf59321 100644 --- a/README.md +++ b/README.md @@ -36,30 +36,30 @@ npm create electron-vite ```diff + ├─┬ electron + │ ├─┬ main -+ │ │ └── index.ts entry of Electron-main ++ │ │ └── index.ts entry of Electron-Main + │ └─┬ preload -+ │ └── index.ts entry of Electron-preload ++ │ └── index.ts entry of Preload-Scripts ├─┬ src - │ └── main.ts entry of Electron-renderer + │ └── main.ts entry of Electron-Renderer ├── index.html ├── package.json └── vite.config.ts ``` -## 🚨 `dependencies` vs `devDependencies` +## 🚨 -**Put Node.js packages in `dependencies`** +By default, this template integrates Node.js in the Renderer process. If you don't need it, you just remove the option below. [Because it will modify the default config of Vite](https://github.com/electron-vite/vite-plugin-electron/tree/main/packages/electron-renderer#config-presets-opinionated). -**e.g.** `electron-store` `sqlite3` `serilaport` `mongodb` ...others - -**Put Web packages in `devDependencies`** - -**e.g.** `vue` `vue-router` `vuex` `pinia` `element-plus` `ant-design-vue` `axios` ...others - -See more 👉 [dependencies vs devDependencies](https://github.com/electron-vite/vite-plugin-electron-renderer#dependencies-vs-devdependencies) +```diff +# vite.config.ts -## 🚨 Node.js ESM packages +electron({ +- renderer: {} +}) +``` -**e.g.** `node-fetch` `execa` `got` ... +## FAQ -[👉 Using Node.js ESM packages in Electron-Renderer](https://github.com/electron-vite/vite-plugin-electron-renderer#-nodejs-esm-packages) +- [dependencies vs devDependencies](https://github.com/electron-vite/vite-plugin-electron/tree/main/packages/electron-renderer#dependencies-vs-devdependencies) +- [Using C/C++ native addons in Electron-Renderer](https://github.com/electron-vite/vite-plugin-electron/tree/main/packages/electron-renderer#load-nodejs-cc-native-modules) +- [Node.js ESM packages](https://github.com/electron-vite/vite-plugin-electron/tree/main/packages/electron-renderer#nodejs-esm-packages) (e.g. `execa` `node-fetch`)