-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathelectron.vite.config.ts
More file actions
72 lines (69 loc) · 1.7 KB
/
electron.vite.config.ts
File metadata and controls
72 lines (69 loc) · 1.7 KB
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
import { resolve } from "node:path"
import react from "@vitejs/plugin-react"
import { defineConfig, externalizeDepsPlugin } from "electron-vite"
import pkg from "./package.json"
const sharedAlias = {
"@shared": resolve(__dirname, "src/shared"),
}
const rendererAlias = {
...sharedAlias,
"@ui": resolve(__dirname, "src/ui"),
}
export default defineConfig({
main: {
plugins: [],
resolve: { alias: sharedAlias },
build: {
minify: true,
sourcemap: false,
rollupOptions: {
input: {
index: resolve(__dirname, "src/main/index.ts"),
},
external: ["electron", "uiohook-napi", "@ghostery/adblocker-electron-preload"],
treeshake: {
moduleSideEffects: false,
},
},
},
},
preload: {
plugins: [externalizeDepsPlugin()],
resolve: { alias: sharedAlias },
build: {
minify: true,
sourcemap: false,
lib: {
entry: resolve(__dirname, "src/preload/index.ts"),
formats: ["cjs"],
fileName: () => "index.js",
},
rollupOptions: {
output: {
entryFileNames: "index.js",
},
},
},
},
renderer: {
root: "src/ui",
publicDir: "public",
plugins: [react()],
define: { __APP_VERSION__: JSON.stringify(pkg.version) },
resolve: { alias: rendererAlias },
build: {
minify: true,
sourcemap: false,
rollupOptions: {
input: {
navbar: resolve(__dirname, "src/ui/navbar/index.html"),
notifications: resolve(__dirname, "src/ui/notifications/index.html"),
downloads: resolve(__dirname, "src/ui/downloads/index.html"),
findbar: resolve(__dirname, "src/ui/findbar/index.html"),
watermark: resolve(__dirname, "src/ui/watermark/index.html"),
config: resolve(__dirname, "src/ui/config/index.html"),
},
},
},
},
})