2024-03-21 16:28:25 +01:00
|
|
|
import { defineConfig, externalizeDepsPlugin } from 'electron-vite';
|
|
|
|
import react from '@vitejs/plugin-react';
|
|
|
|
|
|
|
|
|
|
|
|
export default defineConfig({
|
|
|
|
main: {
|
|
|
|
// https://electron-vite.org/guide/dev#dependencies-vs-devdependencies
|
|
|
|
// For the main process and preload, the best practice is to externalize dependencies and only bundle our own code.
|
|
|
|
// However, until we use ESM for electron main, we need to include ESM-only deps in the bundle: (exclude from externalize)
|
2024-08-27 22:01:00 +02:00
|
|
|
plugins: [externalizeDepsPlugin({ exclude: ['p-map', 'execa', 'nanoid', 'file-type'] })],
|
2024-07-20 16:05:33 +02:00
|
|
|
build: {
|
2024-08-06 21:06:50 +02:00
|
|
|
target: 'node20.14',
|
2024-07-20 16:05:33 +02:00
|
|
|
sourcemap: true,
|
|
|
|
},
|
2024-03-21 16:28:25 +01:00
|
|
|
},
|
|
|
|
preload: {
|
|
|
|
// https://electron-vite.org/guide/dev#dependencies-vs-devdependencies
|
|
|
|
plugins: [externalizeDepsPlugin({ exclude: [] })],
|
2024-07-20 16:05:33 +02:00
|
|
|
build: {
|
2024-08-06 21:06:50 +02:00
|
|
|
target: 'node20.14',
|
2024-07-20 16:05:33 +02:00
|
|
|
sourcemap: true,
|
|
|
|
},
|
2024-03-21 16:28:25 +01:00
|
|
|
},
|
|
|
|
renderer: {
|
|
|
|
plugins: [react()],
|
|
|
|
build: {
|
2024-08-06 21:06:50 +02:00
|
|
|
target: 'chrome126',
|
2024-03-21 16:28:25 +01:00
|
|
|
sourcemap: true,
|
2024-07-20 16:05:33 +02:00
|
|
|
chunkSizeWarningLimit: 3e6,
|
2024-03-21 16:28:25 +01:00
|
|
|
},
|
|
|
|
server: {
|
|
|
|
port: 3001,
|
|
|
|
host: '127.0.0.1',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|