- 新增 `shared/` 目录,统一管理前后端共享的类型定义与工具函数,消除重复代码 - 重构 IPC 数据传输,使用 `toIpcSafeSnapshot` 确保序列化安全 - 新增系统托盘独立窗口 (`/tray` 路由) 与主窗口关闭行为设置,提升用户体验 - 优化 Sing-box 配置校验错误提示,增强可读性 - 修复订阅更新无新节点时的提示逻辑 - 更新项目依赖与构建配置,支持共享层路径别名 (`@shared`) - 补充单元测试,完善国际化词条
62 lines
1.4 KiB
TypeScript
62 lines
1.4 KiB
TypeScript
import { defineConfig } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import electron from 'vite-plugin-electron/simple'
|
|
import UnoCSS from 'unocss/vite'
|
|
import AutoImport from 'unplugin-auto-import/vite'
|
|
import Components from 'unplugin-vue-components/vite'
|
|
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers'
|
|
import { resolve } from 'path'
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
plugins: [
|
|
vue(),
|
|
UnoCSS(),
|
|
AutoImport({
|
|
imports: [
|
|
'vue',
|
|
{
|
|
'naive-ui': [
|
|
'useDialog',
|
|
'useMessage',
|
|
'useNotification',
|
|
'useLoadingBar'
|
|
]
|
|
}
|
|
],
|
|
dts: 'src/autoImport/auto-imports.d.ts'
|
|
}),
|
|
Components({
|
|
resolvers: [NaiveUiResolver()],
|
|
dts: 'src/autoImport/components.d.ts'
|
|
}),
|
|
electron({
|
|
main: {
|
|
entry: 'electron/main/index.ts',
|
|
vite: {
|
|
build: {
|
|
rollupOptions: {
|
|
external: ['better-sqlite3', 'kysely'],
|
|
},
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
'@shared': resolve(__dirname, 'shared'),
|
|
},
|
|
},
|
|
},
|
|
},
|
|
preload: {
|
|
input: 'electron/preload/index.ts',
|
|
},
|
|
renderer: {},
|
|
}),
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
'@': resolve(__dirname, 'src'),
|
|
'@shared': resolve(__dirname, 'shared'),
|
|
},
|
|
},
|
|
})
|