-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
80 lines (76 loc) · 1.65 KB
/
Copy pathvite.config.ts
File metadata and controls
80 lines (76 loc) · 1.65 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import { defineConfig } from 'vite'
import path from 'node:path'
import electron from 'vite-plugin-electron/simple'
import react from '@vitejs/plugin-react'
const nodeBuiltins = [
'node:fs',
'node:fs/promises',
'node:path',
'node:crypto',
'node:child_process',
'node:util',
'node:http',
'node:https',
'node:os',
'node:net',
'node:tls',
'node:stream',
'node:buffer',
'node:events',
'node:url',
'node:zlib',
'node:module',
'node:process',
'node-pty',
'qrcode',
'selfsigned',
'ws',
]
const appInput = {
main: path.join(__dirname, 'index.html'),
remote: path.join(__dirname, 'remote.html'),
}
const electronInput = {
main: path.join(__dirname, 'electron/main.ts'),
ptyHost: path.join(__dirname, 'electron/ptyHost.ts'),
mcpEntry: path.join(__dirname, 'electron/mcpEntry.ts'),
}
export default defineConfig({
build: {
rollupOptions: {
input: appInput,
},
rolldownOptions: {
input: appInput,
},
},
plugins: [
react(),
electron({
main: {
entry: 'electron/main.ts',
vite: {
resolve: {
alias: {
tslib: path.join(__dirname, 'node_modules/tslib/tslib.es6.mjs'),
},
},
build: {
rolldownOptions: {
input: electronInput,
external: nodeBuiltins,
},
rollupOptions: {
input: electronInput,
external: nodeBuiltins,
},
},
},
},
preload: {
input: path.join(__dirname, 'electron/preload.ts'),
},
renderer: process.env.NODE_ENV === 'test' ? undefined : {},
}),
],
})