-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathelectron.vite.config.ts
More file actions
57 lines (55 loc) · 1.3 KB
/
electron.vite.config.ts
File metadata and controls
57 lines (55 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import { defineConfig, externalizeDepsPlugin } from "electron-vite";
import react from "@vitejs/plugin-react";
import { resolve } from "path";
// Get port from environment or use default 5173
const port = parseInt(process.env.PORT || "5173", 10);
export default defineConfig({
main: {
plugins: [externalizeDepsPlugin()],
build: {
// @ts-expect-error - electron-vite types are incomplete
rollupOptions: {
input: {
main: resolve(__dirname, "electron/main.ts"),
},
output: {
format: "cjs",
entryFileNames: "[name].cjs",
},
},
},
},
preload: {
plugins: [externalizeDepsPlugin()],
build: {
// @ts-expect-error - electron-vite types are incomplete
rollupOptions: {
input: {
preload: resolve(__dirname, "electron/preload.ts"),
},
output: {
format: "cjs",
entryFileNames: "[name].cjs",
},
},
},
},
renderer: {
root: ".",
server: {
port,
},
build: {
// @ts-expect-error - electron-vite types are incomplete
rollupOptions: {
input: resolve(__dirname, "index.html"),
},
},
plugins: [react()],
resolve: {
alias: {
"@": resolve(__dirname, "src"),
},
},
},
});