-
Notifications
You must be signed in to change notification settings - Fork 0
/
electron.vite.config.ts
86 lines (83 loc) · 2.52 KB
/
electron.vite.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
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import { join, resolve } from 'path';
import { defineConfig, externalizeDepsPlugin } from 'electron-vite';
import react from '@vitejs/plugin-react';
console.log('------ electron.vite.config.ts:__dirname =', __dirname);
function manualChunks(id: string) { //https://rollupjs.org/configuration-options/#output-manualchunks
// if (dd.some((name) => id.includes(name)) ) {
// return "rare";
// }
if (id.includes("react-dom")) {
return "vendor-dom";
}
if (id.includes("node_modules")) {
return "vendor";
}
if (id.includes("@radix-ui")) {
return "radix-ui";
}
if (id.includes("react-syntax-highlighter")) {
return "rare";
}
if (id.includes("fast-xml-parser")) {
return "rare";
}
}
export default defineConfig({
main: {
build: {
rollupOptions: {
input: {
index: resolve(__dirname, 'src/shell/app/index.ts'),
},
// output: {
// dir: join(__dirname, 'dist-electron/main'),
// },
external: [
'pmat_plugin_nodejs.node',
]
}
},
resolve: {
alias: {
'@electron': resolve(__dirname, 'src/shell/app'),
"@shared": resolve(__dirname, 'src/shared'),
"@shell": resolve(__dirname, 'src/shell/app'),
}
},
plugins: [externalizeDepsPlugin()]
},
preload: {
build: {
rollupOptions: {
input: {
index: resolve(__dirname, 'src/shell/preload/index.ts')
},
// output: {
// dir: join(__dirname, 'dist-electron/preload'),
// }
}
},
plugins: [externalizeDepsPlugin()]
},
renderer: {
resolve: {
alias: {
'@': resolve(__dirname, 'src/renderer/src'),
'@ui': resolve(__dirname, 'src/renderer/src/ui'),
'@renderer': resolve(__dirname, 'src/renderer/src'),
'@electron': resolve(__dirname, 'src/shell/app'),
"@shared": resolve(__dirname, 'src/shared'),
"@shell": resolve(__dirname, 'src/shell/app'),
}
},
build: {
// minify: false,
rollupOptions: {
output: {
manualChunks,
}
}
},
plugins: [react()]
}
});