From c9188fd2f9d8d9f41a60035581c1afbb614916f5 Mon Sep 17 00:00:00 2001 From: younglei Date: Tue, 14 Jun 2022 20:53:01 +0800 Subject: [PATCH] feat: configure vite-plugin-electron --- vite.config.ts | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/vite.config.ts b/vite.config.ts index 315212d..0430ef8 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,7 +1,28 @@ +import { join } from 'path' import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' +import electron from 'vite-plugin-electron' +import renderer from 'vite-plugin-electron/renderer' +import polyfillExports from 'vite-plugin-electron/polyfill-exports' // https://vitejs.dev/config/ export default defineConfig({ - plugins: [vue()] + plugins: [ + vue(), + electron({ + main: { + entry: 'electron-main/index.ts', + }, + preload: { + input: { + // You can configure multiple preload here + p1: join(__dirname, 'electron-preload'), + }, + }, + }), + // Enable use Electron, Node.js API in Renderer-process + renderer(), + // TODO: integrate into 'vite-plugin-electron' by default + polyfillExports(), + ], })