Socket
Socket
Sign inDemoInstall

vite-plugin-resolve

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-resolve - npm Package Compare versions

Comparing version 2.0.4 to 2.0.5

2

package.json
{
"name": "vite-plugin-resolve",
"version": "2.0.4",
"version": "2.0.5",
"description": "Custom resolve module content.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -1,9 +0,13 @@

# vite-plugin-resolve [![NPM version](https://img.shields.io/npm/v/vite-plugin-resolve.svg)](https://npmjs.org/package/vite-plugin-resolve) [![awesome-vite](https://awesome.re/badge.svg)](https://github.com/vitejs/awesome-vite)
# vite-plugin-resolve
Custom resolve module content
[![NPM version](https://img.shields.io/npm/v/vite-plugin-resolve.svg)](https://npmjs.org/package/vite-plugin-resolve)
[![NPM Downloads](https://img.shields.io/npm/dm/vite-plugin-resolve.svg?style=flat)](https://npmjs.org/package/vite-plugin-resolve)
[![awesome-vite](https://awesome.re/badge.svg)](https://github.com/vitejs/awesome-vite)
**English | [简体中文](https://github.com/caoxiemeihao/vite-plugins/blob/main/packages/resolve/README.zh-CN.md)**
- Compatible Browser, Node.js and Electron
- You can think of this as the implementation of the official tutorial 👉 [Virtual Modules Convention](https://vitejs.dev/guide/api-plugin.html#virtual-modules-convention)
✅ Browser, Node.js, Electron
🤔 You can think of this as the implementation of the official tutorial 👉 [Virtual Modules Convention](https://vitejs.dev/guide/api-plugin.html#virtual-modules-convention)

@@ -39,4 +43,6 @@ ## Install

```ts
import fs from 'fs'
resolve({
'path/filename': () => require('fs/promises').readFile('path', 'utf-8'),
'path/filename': () => fs.promise.readFile('path', 'utf-8'),
})

@@ -47,10 +53,22 @@ ```

Resolve Electron `ipcRenderer` in Renderer-process
Resolve Electron Renderer-process
```ts
resolve({
electron: `const { ipcRenderer } = require('electron'); export { ipcRenderer };`,
electron: `
const electron = require("electron");
export { electron as default }
const export shell = electron.shell;
const export ipcRenderer = electron.ipcRenderer;
// ...others
`,
})
```
In you App(Renderer-process)
```ts
import { shell, ipcRenderer } from 'electron'
```
## API

@@ -57,0 +75,0 @@

@@ -1,9 +0,13 @@

# vite-plugin-resolve [![NPM version](https://img.shields.io/npm/v/vite-plugin-resolve.svg)](https://npmjs.org/package/vite-plugin-resolve) [![awesome-vite](https://awesome.re/badge.svg)](https://github.com/vitejs/awesome-vite)
# vite-plugin-resolve
自定义加载模块内容
[![NPM version](https://img.shields.io/npm/v/vite-plugin-resolve.svg)](https://npmjs.org/package/vite-plugin-resolve)
[![NPM Downloads](https://img.shields.io/npm/dm/vite-plugin-resolve.svg?style=flat)](https://npmjs.org/package/vite-plugin-resolve)
[![awesome-vite](https://awesome.re/badge.svg)](https://github.com/vitejs/awesome-vite)
**[English](https://github.com/caoxiemeihao/vite-plugins/tree/main/packages/resolve#readme) | 简体中文**
- 兼容 Browser, Node.js and Electron
- 你可以认为它是官方教程的一个实现 👉 [Virtual Modules Convention](https://vitejs.dev/guide/api-plugin.html#virtual-modules-convention)
✅ Browser, Node.js, Electron
🤔 你可以认为它是官方教程的一个实现 👉 [Virtual Modules Convention](https://vitejs.dev/guide/api-plugin.html#virtual-modules-convention)

@@ -39,4 +43,6 @@ ## 安装

```ts
import fs from 'fs'
resolve({
'path/filename': () => require('fs/promises').readFile('path', 'utf-8'),
'path/filename': () => fs.promise.readFile('path', 'utf-8'),
})

@@ -47,10 +53,22 @@ ```

在 Electron 渲染进程中加载 `ipcRenderer`
加载 Electron 渲染进程
```ts
resolve({
electron: `const { ipcRenderer } = require('electron'); export { ipcRenderer };`,
electron: `
const electron = require("electron");
export { electron as default }
const export shell = electron.shell;
const export ipcRenderer = electron.ipcRenderer;
// ...其他成员
`,
})
```
在渲染进程中使用
```ts
import { shell, ipcRenderer } from 'electron'
```
## API

@@ -57,0 +75,0 @@

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