-
-
Notifications
You must be signed in to change notification settings - Fork 292
/
electron.vite.config.mjs
65 lines (64 loc) · 1.67 KB
/
electron.vite.config.mjs
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
import react from '@vitejs/plugin-react';
import {defineConfig, externalizeDepsPlugin} from 'electron-vite';
import {join} from 'path';
import renderer from 'vite-plugin-electron-renderer';
export default defineConfig({
main: {
build: {
outDir: join(__dirname, 'dist', 'main'),
lib: {
entry: join(__dirname, 'app', 'electron', 'main', 'main.js'),
},
},
// main process has a few imports from common, so this is needed
resolve: {
alias: {
'#local-polyfills': join(__dirname, 'app', 'electron', 'renderer', 'polyfills'),
},
},
plugins: [externalizeDepsPlugin()],
},
preload: {
build: {
outDir: join(__dirname, 'dist', 'preload'),
lib: {
entry: join(__dirname, 'app', 'electron', 'preload', 'preload.mjs'),
},
},
plugins: [externalizeDepsPlugin()],
},
renderer: {
build: {
outDir: join(__dirname, 'dist', 'renderer'),
rollupOptions: {
input: {
main: join(__dirname, 'app', 'common', 'index.html'),
splash: join(__dirname, 'app', 'common', 'splash.html'),
},
},
},
css: {
preprocessorOptions: {
less: {
javascriptEnabled: true,
additionalData: '@root-entry-name: default;',
},
},
},
optimizeDeps: {
include: ['i18next-fs-backend'],
esbuildOptions: {
supported: {
'top-level-await': true,
},
},
},
plugins: [react(), renderer()],
resolve: {
alias: {
'#local-polyfills': join(__dirname, 'app', 'electron', 'renderer', 'polyfills'),
},
},
root: join(__dirname, 'app', 'common'),
},
});