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.0.1 to 0.1.0

index.js

8

package.json
{
"name": "vite-plugin-electron-renderer",
"version": "0.0.1",
"version": "0.1.0",
"description": "Use Electron and NodeJs API in Renderer-process",
"main": "src/index.js",
"main": "index.js",
"repository": "https://github.com/caoxiemeihao/vite-plugins/tree/main/packages/electron-renderer",
"readme": "https://github.com/caoxiemeihao/vite-plugins/tree/main/packages/electron-renderer#readme",
"author": "草鞋没号 <308487730@qq.com>",

@@ -16,4 +17,5 @@ "license": "MIT",

"plugin",
"electron"
"electron",
"renderer"
]
}
[![npm package](https://nodei.co/npm/vite-plugin-electron-renderer.png?downloads=true&downloadRank=true&stars=true)](https://www.npmjs.com/package/vite-plugin-electron-renderer)
# Use Electron and NodeJs API in Renderer-process | [简体中文](./README.zh-CN.md)
# Use Electron and NodeJs API in Renderer-process | [简体中文](https://github.com/caoxiemeihao/vite-plugins/blob/main/packages/electron-renderer/README.zh-CN.md)

@@ -38,6 +38,12 @@ [![NPM version](https://img.shields.io/npm/v/vite-plugin-electron-renderer.svg?style=flat)](https://npmjs.org/package/vite-plugin-electron-renderer)

1. The plugin transform 'electron' and NodeJs builtin modules to ESModule format in 'vite serve' phase.
1. Fist, If you do not configure the following options, the plugin will modify their default values
2. Add 'electron' and NodeJs builtin modules to Rollup 'output.external' option in the 'vite build' phase.
* `base = './'`
* `build.assetsDir = ''`
* `build.rollupOptions.output.format = 'cjs'`
2. The plugin transform 'electron' and NodeJs builtin modules to ESModule format in 'vite serve' phase.
3. Add 'electron' and NodeJs builtin modules to Rollup 'output.external' option in the 'vite build' phase.
**Using electron in Renderer-process**

@@ -62,4 +68,4 @@ `import { ipcRenderer } from 'electron`

resolve: {
// In 'vite serve' phase 'electron-store' will generate file to `node_modules/.vite-plugin-electron-renderer/electron-store.js`, and redirect to this path through 'resolve.alias' config.
// In 'vite build' phase 'electron-store' will added to Rollup `output.external` option.
// In 'vite serve' phase 'electron-store' will generate file to `node_modules/.vite-plugin-electron-renderer/electron-store.js`
// Then point 'electron-store' to this path through 'resolve.alias'
'electron-store': `const Store=require('electron-store'); export default Store;`;

@@ -66,0 +72,0 @@ sqlite3: () => {

[![npm package](https://nodei.co/npm/vite-plugin-electron-renderer.png?downloads=true&downloadRank=true&stars=true)](https://www.npmjs.com/package/vite-plugin-electron-renderer)
# 支持在渲染进程中使用 Electron and NodeJs API | [English](./README.md)
# 支持在渲染进程中使用 Electron and NodeJs API | [English](https://github.com/caoxiemeihao/vite-plugins/tree/main/packages/electron-renderer#readme)

@@ -37,6 +37,12 @@ [![NPM version](https://img.shields.io/npm/v/vite-plugin-electron-renderer.svg?style=flat)](https://npmjs.org/package/vite-plugin-electron-renderer)

1. 开发阶段(`vite serve`) 将 Electron 和 NodeJs 内置模块转换成 ESModule 格式
1. 首先,在你没主动配置过下列配置时,插件会修改它们的默认值
2. 打包阶段(`vite build`) 将 'electron' 和 NodeJs 内置模块插入到 Rollup 的 'output.external' 中
* `base = './'`
* `build.assetsDir = ''`
* `build.rollupOptions.output.format = 'cjs'`
2. 开发阶段(`vite serve`) 将 Electron 和 NodeJs 内置模块转换成 ESModule 格式
3. 打包阶段(`vite build`) 将 'electron' 和 NodeJs 内置模块插入到 Rollup 的 'output.external' 中
**Using electron in Renderer-process**

@@ -61,4 +67,4 @@ `import { ipcRenderer } from 'electron`

resolve: {
// 在 'vite serve' 阶段 'electron-store' 会生成到 `node_modules/.vite-plugin-electron-renderer/electron-store.js` 中, 并且配置 `resolve.alias` 指向这个路径.
// 在 'vite build' 阶段 'electron-store' 会添加到 Rollup `output.external` 配置中.
// 在 'vite serve' 阶段 'electron-store' 会生成到 `node_modules/.vite-plugin-electron-renderer/electron-store.js` 中
// 然后配置 `resolve.alias` 指向这个路径
'electron-store': `const Store=require('electron-store'); export default Store;`;

@@ -65,0 +71,0 @@ sqlite3: () => {

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