Socket
Socket
Sign inDemoInstall

vite-plugin-electron-renderer

Package Overview
Dependencies
Maintainers
2
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.6.0 to 0.8.1

plugins/build-config.d.ts

23

package.json
{
"name": "vite-plugin-electron-renderer",
"version": "0.6.0",
"version": "0.8.1",
"description": "Support use Node.js API in Electron-Renderer",
"main": "dist/index.js",
"main": "plugins/index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/electron-vite/vite-plugin-electron-renderer.git",
"url": "git+https://github.com/electron-vite/vite-plugin-electron.git",
"directory": "packages/electron-renderer"

@@ -13,10 +13,13 @@ },

"license": "MIT",
"scripts": {
"dev": "rm -rf dist && tsc --watch",
"build": "rm -rf dist && tsc",
"prepublishOnly": "npm run build"
},
"dependencies": {},
"devDependencies": {
"@types/node": "^18.0.3",
"typescript": "^4.7.4",
"vite": "^3.0.2"
},
"files": [
"dist"
"plugins"
],

@@ -28,7 +31,3 @@ "keywords": [

"renderer"
],
"scripts": {
"dev": "rm -rf dist && tsc --watch",
"build": "rm -rf dist && tsc"
}
}
]
}

@@ -5,4 +5,4 @@ # vite-plugin-electron-renderer

[![NPM version](https://img.shields.io/npm/v/vite-plugin-electron-renderer.svg?style=flat)](https://npmjs.org/package/vite-plugin-electron-renderer)
[![NPM Downloads](https://img.shields.io/npm/dm/vite-plugin-electron-renderer.svg?style=flat)](https://npmjs.org/package/vite-plugin-electron-renderer)
[![NPM version](https://img.shields.io/npm/v/vite-plugin-electron-renderer.svg)](https://npmjs.org/package/vite-plugin-electron-renderer)
[![NPM Downloads](https://img.shields.io/npm/dm/vite-plugin-electron-renderer.svg)](https://npmjs.org/package/vite-plugin-electron-renderer)

@@ -94,7 +94,7 @@ English | [简体中文](https://github.com/electron-vite/vite-plugin-electron/blob/main/packages/electron-renderer/README.zh-CN.md)

First put the Node.js(CJS) packages into `dependencies`.
First, put the Node.js(CJS) packages into `dependencies`.
Second, you need to explicitly specify which packages are Node.js(CJS) packages for `vite-plugin-electron-renderer` by `options.resolve()`. This way they will be treated as `external` modules and loaded correctly. Thereby avoiding the problems caused by the Pre-Building of Vite.
Second, you need to explicitly specify which packages are Node.js(CJS) packages for `vite-plugin-electron-renderer` by `options.resolve()`. This way they will be treated as `external` modules and loaded correctly. Thereby avoiding the problems caused by the Pre-Bundling of Vite.
Its actual works principle is to generate a virtual module in ESM format by `load-hook` during `vite serve` to ensure that it can work normally. It's inserted into `rollupOptions.external` during `vite build` time.
It's essentially works principle is to generate a virtual module in ESM format by `load-hook` during `vite serve` to ensure that it can work normally. It's inserted into `rollupOptions.external` during `vite build` time.

@@ -138,3 +138,3 @@ #### Load Node.js C/C++ native modules

│ 2. Intercept in load-hook(Plugin) │
│ 3. Generate a virtual module(electron) │
│ 3. Generate a virtual ESM module(electron) │
│ ↓ │

@@ -141,0 +141,0 @@ │ const { ipcRenderer } = require('electron') │

@@ -7,3 +7,3 @@ # vite-plugin-electron-renderer

> 通常的,Vite 可能不能正确的构建 Node.js 包,尤其是 C/C++ 原生模块,但是 Vite 可以将它们以外部包(`external`)的形式加载它们。**除非你知道如何用 Vite 正确的构建它们 -- 鲁迅**
> 通常的,Vite 可能不能正确的构建 Node.js 包,尤其是 Node.js C/C++ 原生模块,但是 Vite 可以将它们以外部包(`external`)的形式加载它们。**除非你知道如何用 Vite 正确的构建它们 -- 鲁迅**

@@ -88,3 +88,3 @@ <table>

│ 2. Intercept in load-hook(Plugin) │
│ 3. Generate a virtual module(electron) │
│ 3. Generate a virtual ESM module(electron) │
│ ↓ │

@@ -91,0 +91,0 @@ │ const { ipcRenderer } = require('electron') │

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