mirror of
https://github.com/electron-vite/electron-vite-vue
synced 2025-01-19 20:07:06 +08:00
chore(docs): explain directory.
This commit is contained in:
parent
cf3fd496ab
commit
cab60cf2fb
25
README.md
25
README.md
@ -28,6 +28,8 @@
|
|||||||
|
|
||||||
## Directory
|
## Directory
|
||||||
|
|
||||||
|
Once `dev` or `build` npm-script executed will be generate named `dist` folder. It has children dir of same as `src` folder, the purpose of this design can ensure the correct path calculation.
|
||||||
|
|
||||||
```tree
|
```tree
|
||||||
├
|
├
|
||||||
├── configs
|
├── configs
|
||||||
@ -35,6 +37,11 @@
|
|||||||
├ ├── vite-preload.config.ts Preload-script config file, for -> src/preload
|
├ ├── vite-preload.config.ts Preload-script config file, for -> src/preload
|
||||||
├ ├── vite-renderer.config.ts Renderer-script config file, for -> src/renderer
|
├ ├── vite-renderer.config.ts Renderer-script config file, for -> src/renderer
|
||||||
├
|
├
|
||||||
|
├── dist After build, it is generated according to the "src" directory
|
||||||
|
├ ├── main
|
||||||
|
├ ├── preload
|
||||||
|
├ ├── renderer
|
||||||
|
├
|
||||||
├── scripts
|
├── scripts
|
||||||
├ ├── build.mjs Build script, for -> npm run build
|
├ ├── build.mjs Build script, for -> npm run build
|
||||||
├ ├── watch.mjs Develop script, for -> npm run dev
|
├ ├── watch.mjs Develop script, for -> npm run dev
|
||||||
@ -46,24 +53,6 @@
|
|||||||
├
|
├
|
||||||
```
|
```
|
||||||
|
|
||||||
#### `dist` and `src`
|
|
||||||
|
|
||||||
- Once `npm run dev` or `npm run build` is executed. Will be generated `dist`, it is the same as the `src` structure.
|
|
||||||
|
|
||||||
- This ensures the accuracy of path calculation.
|
|
||||||
|
|
||||||
```tree
|
|
||||||
├── dist
|
|
||||||
├ ├── main
|
|
||||||
├ ├── preload
|
|
||||||
├ ├── renderer
|
|
||||||
├── src
|
|
||||||
├ ├── main
|
|
||||||
├ ├── preload
|
|
||||||
├ ├── renderer
|
|
||||||
├
|
|
||||||
```
|
|
||||||
|
|
||||||
## Use Electron, NodeJs API
|
## Use Electron, NodeJs API
|
||||||
|
|
||||||
> 🚧 By default, Electron don't support the use of API related to Electron and NoeJs in the Renderer-process, but someone still need to use it. If so, you can see the 👉 npm-package **[vitejs-plugin-electron](https://www.npmjs.com/package/vitejs-plugin-electron)** or another template **[electron-vite-boilerplate](https://github.com/caoxiemeihao/electron-vite-boilerplate)**
|
> 🚧 By default, Electron don't support the use of API related to Electron and NoeJs in the Renderer-process, but someone still need to use it. If so, you can see the 👉 npm-package **[vitejs-plugin-electron](https://www.npmjs.com/package/vitejs-plugin-electron)** or another template **[electron-vite-boilerplate](https://github.com/caoxiemeihao/electron-vite-boilerplate)**
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
|
|
||||||
## 目录结构
|
## 目录结构
|
||||||
|
|
||||||
|
一旦启动或打包脚本执行过,会在根目录产生 **`dist` 文件夹,里面的文件夹同 `src` 一模一样**;在使用一些路径计算时,尤其是相对路径计算;`dist` 与 `src` 里面保持相同的目录结构能避开好多问题
|
||||||
|
|
||||||
```tree
|
```tree
|
||||||
├
|
├
|
||||||
├── configs
|
├── configs
|
||||||
@ -35,6 +37,11 @@
|
|||||||
├ ├── vite-preload.config.ts 预加载脚本配置文件,编译 src/preload
|
├ ├── vite-preload.config.ts 预加载脚本配置文件,编译 src/preload
|
||||||
├ ├── vite-renderer.config.ts 渲染进程配置文件,编译 src/renderer
|
├ ├── vite-renderer.config.ts 渲染进程配置文件,编译 src/renderer
|
||||||
├
|
├
|
||||||
|
├── dist 构建后,根据 src 目录生成
|
||||||
|
├ ├── main
|
||||||
|
├ ├── preload
|
||||||
|
├ ├── renderer
|
||||||
|
├
|
||||||
├── scripts
|
├── scripts
|
||||||
├ ├── build.mjs 项目构建脚本,对应 npm run build
|
├ ├── build.mjs 项目构建脚本,对应 npm run build
|
||||||
├ ├── watch.mjs 项目开发脚本,对应 npm run dev
|
├ ├── watch.mjs 项目开发脚本,对应 npm run dev
|
||||||
@ -46,25 +53,6 @@
|
|||||||
├
|
├
|
||||||
```
|
```
|
||||||
|
|
||||||
#### `dist` 与 `src`
|
|
||||||
|
|
||||||
- 一旦启动或打包脚本执行过,会在根目录产生 **`dist` 文件夹,里面的文件夹同 `src` 一模一样**
|
|
||||||
|
|
||||||
- 在使用一些路径计算时,尤其是相对路径计算;`dist` 与 `src` 里面保持相同的目录结构能避开好多问题
|
|
||||||
|
|
||||||
```tree
|
|
||||||
├── dist
|
|
||||||
├ ├── main
|
|
||||||
├ ├── preload
|
|
||||||
├ ├── renderer
|
|
||||||
├── src
|
|
||||||
├ ├── main
|
|
||||||
├ ├── preload
|
|
||||||
├ ├── renderer
|
|
||||||
├
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## 渲染进程使用 NodeJs API
|
## 渲染进程使用 NodeJs API
|
||||||
|
|
||||||
> 🚧 因为安全的原因 Electron 默认不支持在 渲染进程 中使用 NodeJs API,但是有些小沙雕就是想这么干,拦都拦不住;实在想那么干的话,这里有个 👉 npm 包 **[vitejs-plugin-electron](https://www.npmjs.com/package/vitejs-plugin-electron)** 或者使用另一个模板 **[electron-vite-boilerplate](https://github.com/caoxiemeihao/electron-vite-boilerplate)**
|
> 🚧 因为安全的原因 Electron 默认不支持在 渲染进程 中使用 NodeJs API,但是有些小沙雕就是想这么干,拦都拦不住;实在想那么干的话,这里有个 👉 npm 包 **[vitejs-plugin-electron](https://www.npmjs.com/package/vitejs-plugin-electron)** 或者使用另一个模板 **[electron-vite-boilerplate](https://github.com/caoxiemeihao/electron-vite-boilerplate)**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user