// Plugins import vue from "@vitejs/plugin-vue"; import { defineConfig } from "vite"; import { fileURLToPath, URL } from "node:url"; import electron from "vite-plugin-electron"; import electronRenderer from "vite-plugin-electron/renderer"; import polyfillExports from "vite-plugin-electron/polyfill-exports"; export default defineConfig({ plugins: [ vue(), electron({ main: { entry: "electron-main/index.ts", // 主进程文件 }, preload: { input: fileURLToPath(new URL("./index.js", import.meta.url)), // 预加载文件 }, }), electronRenderer(), polyfillExports(), ], define: { "process.env": {} }, resolve: { alias: { "@": fileURLToPath(new URL("./src", import.meta.url)), }, extensions: [".js", ".json", ".jsx", ".mjs", ".ts", ".tsx", ".vue"], }, build: { sourcemap: true, }, });