-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathelectron.vite.config.mts
More file actions
53 lines (51 loc) · 1.72 KB
/
electron.vite.config.mts
File metadata and controls
53 lines (51 loc) · 1.72 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
import react from '@vitejs/plugin-react';
import { defineConfig } from 'electron-vite';
import tsconfigPaths from 'vite-tsconfig-paths';
const NODE_TARGET = 'node24.15';
const BROWSER_TARGET = 'chrome148';
export default defineConfig({
main: {
build: {
target: NODE_TARGET,
outDir: './build/main',
lib: {
entry: 'src/main/index.ts',
formats: ['cjs'],
},
externalizeDeps: {
// https://electron-vite.org/guide/dependency-handling#customizing
// pure-ESM modules cannot be externalized, we need to bundle them,
// until we can use native ESM in Electron main process
exclude: ['chalk', 'electron-store'],
},
},
plugins: [tsconfigPaths()],
},
preload: {
build: {
target: NODE_TARGET,
outDir: './build/preload',
lib: {
entry: 'src/preload/index.ts',
formats: ['cjs'],
},
// https://www.electronjs.org/docs/latest/tutorial/sandbox#preload-scripts
// in sandbox mode, preload scripts run in a separate context,
// `require` function is a polyfill with limited functionality,
// we need to bundle all dependencies in preload scripts
externalizeDeps: false,
},
plugins: [tsconfigPaths()],
},
renderer: {
build: {
target: BROWSER_TARGET,
outDir: './build/renderer',
rollupOptions: {
input: 'src/renderer/index.html',
},
copyPublicDir: true,
},
plugins: [react(), tsconfigPaths()],
},
});