docs: update

This commit is contained in:
草鞋没号 2022-07-20 08:47:41 +08:00
parent 66c380af90
commit d79f8fc16c

View File

@ -36,30 +36,30 @@ npm create electron-vite
```diff ```diff
+ ├─┬ electron + ├─┬ electron
+ │ ├─┬ main + │ ├─┬ main
+ │ │ └── index.ts entry of Electron-main + │ │ └── index.ts entry of Electron-Main
+ │ └─┬ preload + │ └─┬ preload
+ │ └── index.ts entry of Electron-preload + │ └── index.ts entry of Preload-Scripts
├─┬ src ├─┬ src
│ └── main.ts entry of Electron-renderer │ └── main.ts entry of Electron-Renderer
├── index.html ├── index.html
├── package.json ├── package.json
└── vite.config.ts └── 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 ```diff
# vite.config.ts
**Put Web packages in `devDependencies`** electron({
- renderer: {}
})
```
**e.g.** `vue` `vue-router` `vuex` `pinia` `element-plus` `ant-design-vue` `axios` ...others ## FAQ
See more 👉 [dependencies vs devDependencies](https://github.com/electron-vite/vite-plugin-electron-renderer#dependencies-vs-devdependencies) - [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 - [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`)
**e.g.** `node-fetch` `execa` `got` ...
[👉 Using Node.js ESM packages in Electron-Renderer](https://github.com/electron-vite/vite-plugin-electron-renderer#-nodejs-esm-packages)