We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
找了半天也没找到现成的例子,对vite也不熟。 自己摸索了半天终于试出来了,分享给大家让你们少踩点坑。
multi preload config sample: vite.config.ts
import { defineConfig, loadEnv } from "vite"; import path from "node:path"; import electron from "vite-plugin-electron/simple"; import react from "@vitejs/plugin-react"; import pkg from "./package.json"; // https://vitejs.dev/config/ export default defineConfig({ resolve: { alias: { "@": path.resolve(__dirname, "src"), }, }, plugins: [ react(), electron({ main: { // Shortcut of `build.lib.entry`. entry: [ "electron/main.ts", "electron/worker.ts", "electron/sqlite3.ts", ], vite: { build: { rollupOptions: { external: Object.keys( "dependencies" in pkg ? pkg.dependencies : {} ), }, }, }, }, preload: { input: [ path.join(__dirname, "electron/preload.ts"), path.join(__dirname, "electron/preload2.ts"), ], vite: { build: { rollupOptions: { output: { inlineDynamicImports: false, }, }, }, }, }, // Ployfill the Electron and Node.js API for Renderer process. // If you want use Node.js in Renderer process, the `nodeIntegration` needs to be enabled in the Main process. // See 👉 https://github.com/electron-vite/vite-plugin-electron-renderer renderer: {}, }), ], });
The text was updated successfully, but these errors were encountered:
No branches or pull requests
找了半天也没找到现成的例子,对vite也不熟。
自己摸索了半天终于试出来了,分享给大家让你们少踩点坑。
multi preload config sample:
vite.config.ts
The text was updated successfully, but these errors were encountered: