-
Notifications
You must be signed in to change notification settings - Fork 1
/
vite.config.ts
77 lines (76 loc) · 2.43 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import electron from 'vite-plugin-electron';
import path from 'path';
import vue from '@vitejs/plugin-vue';
import { defineConfig } from 'vite';
import { fileURLToPath, URL } from 'node:url';
export default defineConfig({
plugins: [
vue(),
electron({
entry: ['electron/main.ts', 'electron/preload.ts'],
vite: {
build: {
emptyOutDir: true,
rollupOptions: {
external: [
'@fortawesome/fontawesome-svg-core',
'@fortawesome/free-brands-svg-icons',
'@fortawesome/free-regular-svg-icons',
'@fortawesome/free-solid-svg-icons',
'@fortawesome/vue-fontawesome',
'bulma',
'electron-store',
'electron-updater',
'floating-vue',
'puppeteer',
'vue-draggable-next',
'vue-i18n',
'winston',
'zod',
],
plugins: [
{
name: 'alias',
resolveId(source) {
const resolvedPath = source.endsWith('.ts') ? source : `${source}.ts`;
if (source === '@') {
return path.resolve(__dirname, 'src', resolvedPath);
} else if (source.startsWith('@electron/translate')) {
return path.resolve(
__dirname,
'electron',
source.replace('@electron/', '') + '/index.ts'
);
} else if (source.startsWith('@electron')) {
return path.resolve(
__dirname,
'electron',
resolvedPath.replace('@electron/', '')
);
} else if (source.startsWith('@puppeteer')) {
return path.resolve(
__dirname,
'puppeteer',
resolvedPath.replace('@puppeteer/', '')
);
}
return null;
},
},
],
},
},
},
}),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
'@electron': fileURLToPath(new URL('./electron', import.meta.url)),
'@puppeteer': fileURLToPath(new URL('./puppeteer', import.meta.url)),
},
},
build: {
emptyOutDir: true,
},
});