-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
vite.config.ts
87 lines (77 loc) · 2.66 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
78
79
80
81
82
83
84
85
86
87
import type { UserConfigFn } from 'vite';
import { rmSync } from 'node:fs';
import { resolve } from 'node:path';
import VueI18nPlugin from '@intlify/unplugin-vue-i18n';
import iconify from '@tomjs/vite-plugin-iconify';
import vue from '@vitejs/plugin-vue';
import autoprefixer from 'autoprefixer';
import tailwind from 'tailwindcss';
import VueRouter from 'unplugin-vue-router/vite';
import { defineConfig } from 'vite';
import electron from 'vite-plugin-electron';
import renderer from 'vite-plugin-electron-renderer';
export default defineConfig((({ command }) => {
rmSync('out', { recursive: true, force: true });
const isServe = command === 'serve';
const isBuild = command === 'build';
return {
build: {
outDir: 'out/dist',
},
css: {
postcss: {
plugins: [tailwind(), autoprefixer()],
},
},
plugins: [
VueRouter(),
vue({
template: {
compilerOptions: {
isCustomElement: tag => ['webview'].includes(tag),
},
},
}),
iconify({
resources: ['https://unpkg.com/@iconify/json/json'],
rotate: 3000,
local: ['pepicons-print', 'fa6-brands', 'fa6-solid', 'fa6-regular', 'svg-spinners'],
}),
VueI18nPlugin.vite({
include: resolve(process.cwd(), './i18n/locales/**'),
runtimeOnly: false,
}),
electron([
{
entry: 'electron/main/background.ts',
onstart(options) {
options.startup();
},
vite: {
resolve: {
alias: {
'#shared': resolve(process.cwd(), 'shared'),
},
},
build: {
sourcemap: isServe,
minify: isBuild,
outDir: 'out/dist-electron/main',
},
},
},
]),
// Use Node.js API in the Renderer-process
renderer(),
],
clearScreen: false,
resolve: {
alias: {
'#shared': resolve(__dirname, 'shared'),
'#components': resolve(__dirname, 'src/components'),
'#lib': resolve(__dirname, 'src/lib'),
'#layouts': resolve(__dirname, 'src/layouts'),
},
},
};
}) as UserConfigFn);