forked from shirumesu/NeoPot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathelectron.vite.config.ts
More file actions
84 lines (81 loc) · 1.97 KB
/
Copy pathelectron.vite.config.ts
File metadata and controls
84 lines (81 loc) · 1.97 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
81
82
83
84
import { builtinModules } from 'node:module'
import { resolve } from 'node:path'
import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
import { defineConfig } from 'electron-vite'
const external = [
'electron',
...builtinModules,
...builtinModules.map((moduleName) => `node:${moduleName}`),
]
const bundledMainDependencies = [
'adm-zip',
'electron-log',
'electron-store',
'electron-updater',
'tinyld',
]
export default defineConfig({
main: {
build: {
externalizeDeps: {
exclude: bundledMainDependencies,
},
target: 'node22',
outDir: 'out/main',
rollupOptions: {
input: {
index: resolve(__dirname, 'src/main/index.ts'),
},
external,
output: {
format: 'cjs',
entryFileNames: '[name].cjs',
chunkFileNames: '[name].cjs',
},
},
},
},
preload: {
build: {
target: 'node22',
outDir: 'out/preload',
rollupOptions: {
input: {
index: resolve(__dirname, 'src/preload/index.ts'),
},
external,
output: {
format: 'cjs',
inlineDynamicImports: true,
entryFileNames: 'index.cjs',
chunkFileNames: 'index.cjs',
assetFileNames: '[name].[ext]',
},
},
},
},
renderer: {
root: '.',
plugins: [tailwindcss(), react()],
resolve: {
alias: {
'@': resolve(__dirname, 'src'),
'@assets': resolve(__dirname, 'assets'),
fs: resolve(__dirname, 'src/renderer/lib/nodeBuiltinUnavailable.ts'),
path: resolve(__dirname, 'src/renderer/lib/nodeBuiltinUnavailable.ts'),
crypto: resolve(__dirname, 'src/renderer/lib/nodeBuiltinUnavailable.ts'),
},
},
clearScreen: false,
build: {
target: 'es2020',
outDir: 'out/renderer',
rollupOptions: {
input: {
index: resolve(__dirname, 'index.html'),
},
},
},
},
})