-
Notifications
You must be signed in to change notification settings - Fork 22
/
vite.config.ts
54 lines (52 loc) · 1.06 KB
/
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
import path, { resolve } from "path";
import { defineConfig } from "vite";
import electron from "vite-plugin-electron/simple";
import vue from "@vitejs/plugin-vue";
function pathResolve(dir: string) {
return resolve(process.cwd(), ".", dir);
}
export default defineConfig({
build: {
minify: true,
},
plugins: [
vue(),
electron({
main: {
entry: "electron/main.ts",
vite: {
build: {
rollupOptions: {
external: ["sqlite3", "sharp"],
},
},
},
},
preload: {
input: path.join(__dirname, "electron/preload.ts"),
},
renderer: {
resolve: {
sqlite3: { type: "cjs" },
sharp: { type: "cjs" }
},
},
}),
],
// 别名
resolve: {
alias: [
// @/xxxx => src/xxxx
{
find: /\@\//,
replacement: `${pathResolve("src")}/`,
},
// #/xxxx => types/xxxx
{
find: /\#\//,
replacement: `${pathResolve("types")}/`,
},
],
dedupe: ["vue"],
},
});