feat: bumps electron@28, vite@5, vite-plugin-electron@0.28.0-beta.2

This commit is contained in:
草鞋没号 committed 2024-01-03 15:51:51 +08:00
1 parent 5303923340
commit 208ab386b1
12 files changed
+164 -54

No files matched your search

+14 -18
View File
@@ -2,8 +2,7 @@ import { rmSync } from 'node:fs'
import path from 'node:path'
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import electron from 'vite-plugin-electron'
import renderer from 'vite-plugin-electron-renderer'
import electron from 'vite-plugin-electron/simple'
import pkg from './package.json'
// https://vitejs.dev/config/
@@ -22,15 +21,15 @@ export default defineConfig(({ command }) => {
},
plugins: [
react(),
electron([
{
// Main-Process entry file of the Electron App.
electron({
main: {
// Shortcut of `build.lib.entry`
entry: 'electron/main/index.ts',
onstart(options) {
onstart(args) {
if (process.env.VSCODE_DEBUG) {
console.log(/* For `.vscode/.debug.script.mjs` */'[startup] Electron App')
} else {
options.startup()
args.startup()
}
},
vite: {
@@ -44,13 +43,10 @@ export default defineConfig(({ command }) => {
},
},
},
{
entry: 'electron/preload/index.ts',
onstart(options) {
// Notify the Renderer-Process to reload the page when the Preload-Scripts build is complete,
// instead of restarting the entire Electron App.
options.reload()
},
preload: {
// Shortcut of `build.rollupOptions.input`.
// Preload scripts may contain Web assets, so use the `build.rollupOptions.input` instead `build.lib.entry`.
input: 'electron/preload/index.ts',
vite: {
build: {
sourcemap: sourcemap ? 'inline' : undefined, // #332
@@ -61,10 +57,10 @@ export default defineConfig(({ command }) => {
},
},
},
}
]),
// Use Node.js API in the Renderer-process
renderer(),
},
// Use Node.js API in the Renderer process
renderer: {},
}),
],
server: process.env.VSCODE_DEBUG && (() => {
const url = new URL(pkg.debug.env.VITE_DEV_SERVER_URL)