mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-04 06:31:13 +00:00
Update dashboard extension UI to prevent title overflow: add truncate and max-width to the tab title, include the plugin name in the title tooltip, and hide the plugin-name label on small screens (visible from md+). Also add a '/plugin' proxy entry to the Vite dev server config so plugin requests are forwarded to the backend debug URL.
75 lines
2.2 KiB
TypeScript
75 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,
|
|
'/plugin': 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';
|
|
}
|
|
}
|
|
},
|
|
},
|
|
},
|
|
},
|
|
};
|
|
});
|