vite-plugin-electron-renderer
Advanced tools
Comparing version 0.2.0 to 0.2.1
{ | ||
"name": "vite-plugin-electron-renderer", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Use Electron and NodeJs API in Renderer-process", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -47,2 +47,21 @@ # vite-plugin-electron-renderer | ||
- Using Electron API in Renderer-process | ||
```js | ||
import { ipcRenderer } from 'electron' | ||
``` | ||
Actually redirect to "[node_modules/vite-plugin-electron-renderer/modules/electron-renderer.js](modules/electron-renderer.js)" by `resolve.alias` | ||
- Using Node.js API in Renderer-process | ||
```js | ||
import { readFile } from 'fs' | ||
``` | ||
All Node.js API will be built into the `node_modules/.vite-plugin-electron-renderer` directory by [vite-plugin-optimizer](https://www.npmjs.com/package/vite-plugin-optimizer) | ||
## 🚧 Some additional instructions | ||
1. Fist, the plugin will configuration something. | ||
@@ -59,9 +78,1 @@ | ||
3. Add Electron and Node.js built-in modules to Rollup "output.external" option in the "vite build" phase. | ||
**Using Electron API in Renderer-process** `import { ipcRenderer } from 'electron` | ||
Actually redirect to "[node_modules/vite-plugin-electron-renderer/modules/electron-renderer.js](modules/electron-renderer.js)" by `resolve.alias` | ||
**Using Node.js API in Renderer-process** `import { readFile } from 'fs'` | ||
All Node.js API will be built into the `node_modules/.vite-plugin-electron-renderer` directory by [vite-plugin-optimizer](https://www.npmjs.com/package/vite-plugin-optimizer) |
@@ -46,2 +46,20 @@ # vite-plugin-electron-renderer | ||
- 在染进程中使用 electron | ||
```js | ||
import { ipcRenderer } from 'electron' | ||
``` | ||
实际上通过 `resolve.alias` 重定向到 "[node_modules/vite-plugin-electron-renderer/modules/electron-renderer.js](modules/electron-renderer.js)" | ||
- 在染进程中使用 Node.js API | ||
```js | ||
import { readFile } from 'fs' | ||
``` | ||
所有的 Node.js API 将会通过 [vite-plugin-optimizer](https://www.npmjs.com/package/vite-plugin-optimizer) 构建到 `node_modules/.vite-plugin-electron-renderer` 目录 | ||
## 🚧 一些额外的说明 | ||
1. 首先,插件会修改一些配置 | ||
@@ -60,10 +78,1 @@ | ||
3. 打包阶段(`vite build`) 将 Electron 和 Node.Js 内置模块插入到 Rollup 的 `output.external` 中 | ||
**在染进程中使用 electron** `import { ipcRenderer } from 'electron` | ||
实际上通过 `resolve.alias` 重定向到 "[node_modules/vite-plugin-electron-renderer/modules/electron-renderer.js](modules/electron-renderer.js)" | ||
**在染进程中使用 Node.js API** `import { readFile } from 'fs'` | ||
所有的 Node.js API 将会通过 [vite-plugin-optimizer](https://www.npmjs.com/package/vite-plugin-optimizer) 构建到 `node_modules/.vite-plugin-electron-renderer` 目录 | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
8402
77
0