vite-plugin-electron-renderer
Advanced tools
Comparing version 0.5.5 to 0.5.6
## [2022-07-11] v0.5.6 | ||
- d31f917 refactor: `root: string` instead of `config: UserConfig` | ||
## [2022-07-11] v0.5.5 | ||
@@ -3,0 +7,0 @@ |
{ | ||
"name": "vite-plugin-electron-renderer", | ||
"version": "0.5.5", | ||
"version": "0.5.6", | ||
"description": "Support use Node.js API in Electron-Renderer", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -1,2 +0,2 @@ | ||
import { Plugin, UserConfig } from 'vite'; | ||
import { Plugin } from 'vite'; | ||
@@ -23,3 +23,3 @@ declare const useNodeJs: UseNodeJs; | ||
export interface ResolveModules { | ||
(config: UserConfig, options?: Options): { | ||
(root: string, options?: Options): { | ||
/** Node.js builtin modules */ | ||
@@ -26,0 +26,0 @@ builtins: string[]; |
@@ -62,3 +62,6 @@ const fs = require('fs'); | ||
const resolved = resolveModules(config, options); | ||
// https://github.com/vitejs/vite/blob/53799e1cced7957f9877a5b5c9b6351b48e216a7/packages/vite/src/node/config.ts#L439-L442 | ||
const root = normalizePath(config.root ? path.resolve(config.root) : cwd); | ||
const resolved = resolveModules(root, options); | ||
builtins.push(...resolved.builtins); | ||
@@ -190,6 +193,4 @@ dependencies.push(...resolved.dependencies); | ||
*/ | ||
function resolveModules(config, options = {}) { | ||
function resolveModules(root, options = {}) { | ||
const cwd = process.cwd(); | ||
// https://github.com/vitejs/vite/blob/53799e1cced7957f9877a5b5c9b6351b48e216a7/packages/vite/src/node/config.ts#L439-L442 | ||
const root = normalizePath(config.root ? path.resolve(config.root) : cwd) | ||
const builtins = builtinModules.filter(e => !e.startsWith('_')); builtins.push('electron', ...builtins.map(m => `node:${m}`)); | ||
@@ -196,0 +197,0 @@ // dependencies of package.json |
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
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
22914