Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vite-plugin-electron-renderer

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-electron-renderer - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

2

package.json
{
"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` 目录
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc