mirror of
https://github.com/cita-777/metapi.git
synced 2026-10-31 11:11:38 +08:00
* feat: downstream API key usage + proxy log attribution * chore(schema): regenerate generated artifacts * test: keep migration replay + platform detection tests stable * feat: complete downstream api key management validation * refactor: move downstream keys into console nav * feat: upgrade downstream keys management console * feat: harden downstream key management flows * test: cover downstream key policy guards * feat: add downstream key grouping and tags * feat: polish downstream key search and log metadata * test: fix sqlite migration bootstrap coverage * perf: isolate vchart bundle loading * fix: align downstream key drawer metrics --------- Co-authored-by: DeliciousBuding <DeliciousBuding@users.noreply.github.com>
52 lines
1.5 KiB
TypeScript
52 lines
1.5 KiB
TypeScript
import { defineConfig, loadEnv } from 'vite';
|
|
import react from '@vitejs/plugin-react';
|
|
import tailwindcss from '@tailwindcss/vite';
|
|
import { resolveDevProxyTarget } from './src/web/devProxyTarget';
|
|
|
|
export default defineConfig(({ mode }) => {
|
|
const env = loadEnv(mode, process.cwd(), '');
|
|
const proxyTarget = resolveDevProxyTarget(env);
|
|
console.log(`[vite] dev proxy target: ${proxyTarget}`);
|
|
|
|
const frontendPort = Number.parseInt(env.FRONTEND_PORT || env.VITE_FRONTEND_PORT || '', 10);
|
|
const resolvedFrontendPort = Number.isFinite(frontendPort) && frontendPort > 0 ? frontendPort : 5173;
|
|
const frontendHost = (env.VITE_DEV_HOST || '127.0.0.1').trim() || '127.0.0.1';
|
|
|
|
return {
|
|
root: 'src/web',
|
|
plugins: [react(), tailwindcss()],
|
|
build: {
|
|
outDir: '../../dist/web',
|
|
emptyOutDir: true,
|
|
rollupOptions: {
|
|
output: {
|
|
manualChunks(id) {
|
|
if (id.includes('@visactor/react-vchart') || id.includes('/@visactor/')) {
|
|
return 'vchart-vendor';
|
|
}
|
|
return undefined;
|
|
},
|
|
},
|
|
},
|
|
},
|
|
server: {
|
|
host: frontendHost,
|
|
port: resolvedFrontendPort,
|
|
proxy: {
|
|
'^/api($|/)': {
|
|
target: proxyTarget,
|
|
changeOrigin: true,
|
|
},
|
|
'^/monitor-proxy($|/)': {
|
|
target: proxyTarget,
|
|
changeOrigin: true,
|
|
},
|
|
'^/v1($|/)': {
|
|
target: proxyTarget,
|
|
changeOrigin: true,
|
|
},
|
|
},
|
|
},
|
|
};
|
|
});
|