-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.main.config.ts
29 lines (27 loc) · 954 Bytes
/
vite.main.config.ts
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
import type { ConfigEnv, UserConfig } from 'vite';
import { defineConfig } from 'vite';
// https://vitejs.dev/config
export default defineConfig((env) => {
const { mode } = env;
return {
// Explicitly configure build options for main process
build: {
// Ensure Node.js built-ins are handled correctly
commonjsOptions: {
ignoreTryCatch: false, // Recommended for Electron
// Setting nodeIntegration might help preserve require behavior for build
// but doesn't affect the final renderer security.
nodeIntegration: true,
},
// Keep rollupOptions commented out unless needed later
// rollupOptions: {
// external: [],
// },
},
resolve: {
// Some libs that can run in both Web and Node.js, such as `axios`, we need to tell Vite to build them in Node.js.
browserField: false,
mainFields: ['module', 'jsnext:main', 'jsnext'],
},
};
});