forked from Kasper24/walltone
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.main.config.ts
More file actions
49 lines (48 loc) · 1.45 KB
/
Copy pathvite.main.config.ts
File metadata and controls
49 lines (48 loc) · 1.45 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
import path from "path";
import type { ConfigEnv, UserConfig } from "vite";
import { defineConfig, mergeConfig } from "vite";
import { getBuildConfig, getBuildDefine, external, pluginHotRestart } from "./vite.base.config.js";
// https://vitejs.dev/config
export default defineConfig((env) => {
const forgeEnv = env as ConfigEnv<"build">;
const { forgeConfigSelf } = forgeEnv;
const define = getBuildDefine(forgeEnv);
const config: UserConfig = {
build: {
lib: {
entry: forgeConfigSelf.entry!,
fileName: () => "main.js",
formats: ["es"],
},
rollupOptions: {
external,
input: {
main: path.resolve(__dirname, "src/electron/main/index.ts"),
["theme-generator"]: path.resolve(
__dirname,
"src/electron/main/trpc/routes/theme/generator/index.ts"
),
["thumbnail-generator"]: path.resolve(
__dirname,
"src/electron/main/trpc/routes/wallpaper/thumbnail.ts"
),
},
output: {
entryFileNames: "[name].js",
format: "esm",
},
},
},
plugins: [pluginHotRestart("restart")],
define,
resolve: {
// Load the Node.js entry.
mainFields: ["module", "jsnext:main", "jsnext"],
preserveSymlinks: true,
alias: {
"@electron": path.resolve(__dirname, "./src/electron"),
},
},
};
return mergeConfig(getBuildConfig(forgeEnv), config);
});