Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vite-plugin-electron

Package Overview
Dependencies
Maintainers
1
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-electron - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

renderer/index.d.ts

3

dist/index.d.ts
import type { Configuration } from './types';
export { electron as default } from './plugin';
import type { Plugin } from 'vite';
export { Configuration };
export declare function defineConfig(config: Configuration): Configuration;
export default function electron(config: Configuration): Plugin[];
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.defineConfig = exports.default = void 0;
var plugin_1 = require("./plugin");
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return plugin_1.electron; } });
exports.defineConfig = void 0;
const renderer_1 = __importDefault(require("../renderer"));
const serve_1 = require("./serve");
const build_1 = require("./build");
function defineConfig(config) {

@@ -10,1 +14,26 @@ return config;

exports.defineConfig = defineConfig;
function electron(config) {
const name = 'vite-plugin-electron';
return [
{
name: `${name}:serve`,
apply: 'serve',
configureServer(server) {
const printUrls = server.printUrls;
server.printUrls = function () {
printUrls();
(0, serve_1.bootstrap)(config, server);
};
},
},
{
name: `${name}:build`,
apply: 'build',
async configResolved(viteConfig) {
await (0, build_1.build)(config, viteConfig);
},
},
...(config.main.nodeIntegration ? (0, renderer_1.default)() : []),
];
}
exports.default = electron;

@@ -1,11 +0,12 @@

import { UserConfigExport, LibraryOptions } from 'vite';
export interface GeneralConfig {
import type { UserConfigExport, LibraryOptions } from 'vite';
import type { InputOption } from 'rollup';
export interface MainConfig {
/** Alias of build.lib.entry */
entry: LibraryOptions['entry'];
vite?: UserConfigExport;
}
export interface MainConfig extends GeneralConfig {
nodeIntegration?: boolean;
}
export interface PreloadConfig extends GeneralConfig {
export interface PreloadConfig {
entry: InputOption;
vite?: UserConfigExport;
}

@@ -12,0 +13,0 @@ export interface Configuration {

{
"name": "vite-plugin-electron",
"version": "0.1.1",
"version": "0.2.0",
"description": "Integrate Vite and Electron",
"main": "dist/index.js",
"repository": "https://github.com/caoxiemeihao/vite-plugins/tree/main/packages/electron",
"repository": {
"type": "git",
"url": "git+https://github.com/caoxiemeihao/vite-plugin-electron.git"
},
"author": "草鞋没号 <308487730@qq.com>",

@@ -14,3 +17,3 @@ "license": "MIT",

"dependencies": {
"vite-plugin-electron-renderer": "^0.3.2"
"vite-plugin-optimizer": "^1.3.2"
},

@@ -25,4 +28,5 @@ "devDependencies": {

"plugin",
"electron"
"electron",
"renderer"
]
}

@@ -38,1 +38,17 @@ # vite-plugin-electron

```
---
If you only need to build the Renderer-process, you can just use the `vite-plugin-electron-renderer` plugin
**renderer/vite.config.ts**
```js
import electronRenderer from 'vite-plugin-electron/renderer'
export default {
plugins: [
electronRenderer(),
],
}
```
import type { Configuration } from './types'
import type { Plugin } from 'vite'
import renderer from '../renderer'
import { bootstrap } from './serve'
import { build } from './build'
export { electron as default } from './plugin'
export { Configuration }

@@ -9,1 +12,27 @@

}
export default function electron(config: Configuration): Plugin[] {
const name = 'vite-plugin-electron'
return [
{
name: `${name}:serve`,
apply: 'serve',
configureServer(server) {
const printUrls = server.printUrls
server.printUrls = function () {
printUrls()
bootstrap(config, server)
}
},
},
{
name: `${name}:build`,
apply: 'build',
async configResolved(viteConfig) {
await build(config, viteConfig)
},
},
...(config.main.nodeIntegration ? renderer() : []),
]
}

@@ -1,17 +0,18 @@

import {
import type {
UserConfigExport,
LibraryOptions,
} from 'vite'
import type { InputOption } from 'rollup'
export interface GeneralConfig {
export interface MainConfig {
/** Alias of build.lib.entry */
entry: LibraryOptions['entry']
vite?: UserConfigExport
}
export interface MainConfig extends GeneralConfig {
nodeIntegration?: boolean
}
export interface PreloadConfig extends GeneralConfig {
export interface PreloadConfig {
// TODO:
entry: InputOption
vite?: UserConfigExport
}

@@ -18,0 +19,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