mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-01-18 06:20:29 +00:00
* feat: 优化离线重连机制,增加前端登录错误提示与二维码刷新功能 - 增加全局掉线检测弹窗 - 增强登录错误解析,支持显示 serverErrorCode 和 message - 优化二维码登录 UI,错误时显示详细原因并提供大按钮重新获取 - 核心层解耦,通过事件抛出 KickedOffLine 通知 - 支持前端点击刷新二维码接口 * feat: 新增看门狗汪汪汪 * cp napcat-shell-loader/launcher-win.bat * refactor: 重构重启流程,移除旧的重启逻辑,新增基于 WebUI 的重启请求处理 * fix: 刷新二维码清楚错误信息
74 lines
2.2 KiB
TypeScript
74 lines
2.2 KiB
TypeScript
import react from '@vitejs/plugin-react';
|
|
import { defineConfig, loadEnv } from 'vite';
|
|
// import viteCompression from 'vite-plugin-compression';
|
|
import { ViteImageOptimizer } from 'vite-plugin-image-optimizer';
|
|
import tsconfigPaths from 'vite-tsconfig-paths';
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig(({ mode }) => {
|
|
const env = loadEnv(mode, process.cwd());
|
|
const backendDebugUrl = env.VITE_DEBUG_BACKEND_URL;
|
|
console.log('backendDebugUrl', backendDebugUrl);
|
|
return {
|
|
plugins: [
|
|
react(),
|
|
tsconfigPaths(),
|
|
ViteImageOptimizer({}),
|
|
],
|
|
base: '/webui/',
|
|
server: {
|
|
proxy: {
|
|
'/api/ws/terminal': {
|
|
target: backendDebugUrl,
|
|
ws: true,
|
|
changeOrigin: true,
|
|
},
|
|
'/api/Debug/ws': {
|
|
target: backendDebugUrl,
|
|
ws: true,
|
|
changeOrigin: true,
|
|
},
|
|
'/api': backendDebugUrl,
|
|
'/files': backendDebugUrl,
|
|
'/webui/fonts/CustomFont.woff': backendDebugUrl,
|
|
'/webui/sw.js': backendDebugUrl,
|
|
},
|
|
},
|
|
build: {
|
|
assetsInlineLimit: 0,
|
|
rollupOptions: {
|
|
output: {
|
|
manualChunks (id) {
|
|
if (id.includes('node_modules')) {
|
|
// if (id.includes('@heroui/')) {
|
|
// return 'heroui';
|
|
// }
|
|
if (id.includes('react-dom')) {
|
|
return 'react-dom';
|
|
}
|
|
if (id.includes('react-router-dom')) {
|
|
return 'react-router-dom';
|
|
}
|
|
if (id.includes('react-hook-form')) {
|
|
return 'react-hook-form';
|
|
}
|
|
if (id.includes('react-hot-toast')) {
|
|
return 'react-hot-toast';
|
|
}
|
|
if (id.includes('qface')) {
|
|
return 'qface';
|
|
}
|
|
if (id.includes('@uiw/react-codemirror') || id.includes('@codemirror/view') || id.includes('@codemirror/theme-one-dark')) {
|
|
return 'codemirror-core';
|
|
}
|
|
if (id.includes('@codemirror/lang-')) {
|
|
return 'codemirror-lang';
|
|
}
|
|
}
|
|
},
|
|
},
|
|
},
|
|
},
|
|
};
|
|
});
|