
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
vite-plugin-electron-renderer
Advanced tools
Use Electron and Node.js API in Renderer-process
English | 简体中文
npm i vite-plugin-electron-renderer -D
vite.config.ts
import { defineConfig } from 'vite'
import electron from 'vite-plugin-electron-renderer'
export default defineConfig({
plugins: [
electron(),
],
})
renderer.js
import { readFile } from 'fs'
import { ipcRenderer } from 'electron'
readFile(/* something code... */)
ipcRenderer.on('event-name', () => {/* something code... */})
import { ipcRenderer } from 'electron'
Actually redirect to "node_modules/vite-plugin-electron-renderer/modules/electron-renderer.js" by resolve.alias
import { readFile } from 'fs'
All Node.js API will be built into the node_modules/.vite-plugin-electron-renderer
directory by vite-plugin-optimizer
If you do not configure the following options, the plugin will modify their default values
base = './'
build.assetsDir = ''
-> TODO: Automatic splicing "build.assetsDir"build.rollupOptions.output.format = 'cjs'
The plugin transform Electron and Node.js built-in modules to ESModule format in "vite serve" phase.
Add Electron and Node.js built-in modules to Rollup "output.external" option in the "vite build" phase.
FAQs
Support use Node.js API in Electron-Renderer
The npm package vite-plugin-electron-renderer receives a total of 9,572 weekly downloads. As such, vite-plugin-electron-renderer popularity was classified as popular.
We found that vite-plugin-electron-renderer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.