vite-plugin-electron-renderer
Advanced tools
Comparing version 0.0.1 to 0.1.0
{ | ||
"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: () => { |
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
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
13724
86
4
6
224
1