-
-
Notifications
You must be signed in to change notification settings - Fork 290
/
electron.vite.config.mjs
57 lines (56 loc) · 1.5 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
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;',
},
},
},
plugins: [react(), renderer()],
resolve: {
alias: {
'#local-polyfills': join(__dirname, 'app', 'electron', 'renderer', 'polyfills'),
},
},
root: join(__dirname, 'app', 'common'),
},
});