-
Notifications
You must be signed in to change notification settings - Fork 31
/
electron.vite.config.ts
49 lines (47 loc) · 1.36 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
import { resolve } from "path";
import { defineConfig } from "electron-vite-tsup";
import react from "@vitejs/plugin-react-swc";
import stylePlugin from "esbuild-style-plugin";
import tailwindcss from "tailwindcss";
import autoprefixer from "autoprefixer";
export default defineConfig(({ mode }) => {
const isProd = mode === "production",
isTest = process.env.TEST === "true";
return {
main: {
clean: true,
entry: { main: isTest ? "src/main/main.test.ts" : "src/main/main.ts" },
format: "esm",
// The requested module 'electron-updater' is a CommonJS module, which may not support all module.exports as named exports.
noExternal: isProd ? [/(.*)/] : ["electron-updater"],
minify: isProd
},
preload: {
clean: true,
entry: { preload: isTest ? "src/preload/preload.test.ts" : "src/preload/index.ts" },
format: "cjs",
minify: isProd
},
renderer: {
resolve: {
alias: {
"@src": resolve("src"),
"@renderer": resolve("src/renderer/src")
}
},
build: {
clean: true,
entry: ["src/renderer/src/index.tsx"],
minify: true,
esbuildPlugins: [
stylePlugin({
postcss: {
plugins: [tailwindcss(), autoprefixer()]
}
})
]
},
plugins: [react()]
}
};
});