-
-
Notifications
You must be signed in to change notification settings - Fork 33
/
electron.vite.config.ts
68 lines (68 loc) · 1.95 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
import vue from "@vitejs/plugin-vue";
import { defineConfig, externalizeDepsPlugin } from "electron-vite";
import { merge } from "lodash-es";
import { resolve } from "path";
import { UserConfigExport } from "vite";
import svgLoader from 'vite-svg-loader';
const resolveOptions: UserConfigExport = {
resolve: {
alias: {
"@renderer": resolve("src/renderer/src"),
"@main": resolve("src/main"),
"@preload": resolve("src/preload"),
"@shared": resolve("src/shared"),
"@translations": resolve("src/translations"),
"@": resolve("src"),
"~": resolve("."),
},
},
};
const externalizedEsmDeps = ["lodash-es", "@faker-js/faker", "@trpc-limiter/memory", "got", "encryption.js"];
export default defineConfig({
main: {
...resolveOptions,
plugins: [externalizeDepsPlugin({ exclude: [...externalizedEsmDeps] })],
build: {
rollupOptions: {
input: {
index: resolve(__dirname, "src/main/main.ts"),
},
output: {
manualChunks: (id: string): any => {
if (externalizedEsmDeps.find((d) => d === id)) return id;
},
},
},
},
},
preload: {
...resolveOptions,
plugins: [externalizeDepsPlugin({ exclude: [...externalizedEsmDeps] })],
build: {
rollupOptions: {
input: {
"youtube": resolve(__dirname, "src/preload/youtube.ts"),
"api": resolve(__dirname, "src/preload/api.ts"),
"login": resolve(__dirname, "src/preload/login.ts"),
},
},
},
},
renderer: {
...merge({}, resolveOptions, {
resolve: {
alias: {
"@": resolve(__dirname, "src/renderer/src"),
},
},
}),
plugins: [
// (TanStackRouterVite as typeof TanStackRouterViteType)({
// generatedRouteTree: resolve('./src/renderer/src/routeTree.gen.ts'),
// routesDirectory: resolve('./src/renderer/src/routes')
// }),
vue(),
svgLoader()
],
},
});