2026-08-08 07:21:04 +08:00
|
|
|
import { defineConfig } from 'vite';
|
|
|
|
|
import react from '@vitejs/plugin-react';
|
|
|
|
|
import path from 'path';
|
|
|
|
|
|
|
|
|
|
export default defineConfig({
|
2026-08-08 10:39:18 +08:00
|
|
|
base: './',
|
2026-08-08 07:21:04 +08:00
|
|
|
plugins: [react()],
|
|
|
|
|
resolve: {
|
|
|
|
|
alias: {
|
|
|
|
|
// 复用知识库前端组件
|
|
|
|
|
'@': path.resolve(__dirname, '../guanghu-knowledge-base/src'),
|
2026-08-09 03:37:41 +08:00
|
|
|
'react/jsx-dev-runtime': path.resolve(__dirname, 'node_modules/react/jsx-dev-runtime.js'),
|
2026-08-08 10:39:18 +08:00
|
|
|
'react/jsx-runtime': path.resolve(__dirname, 'node_modules/react/jsx-runtime.js'),
|
|
|
|
|
'react-dom/client': path.resolve(__dirname, 'node_modules/react-dom/client.js'),
|
|
|
|
|
'react-dom': path.resolve(__dirname, 'node_modules/react-dom/index.js'),
|
|
|
|
|
'react': path.resolve(__dirname, 'node_modules/react/index.js'),
|
|
|
|
|
'marked': path.resolve(__dirname, 'node_modules/marked/lib/marked.esm.js'),
|
2026-08-10 00:52:54 +08:00
|
|
|
'lucide-react': path.resolve(__dirname, 'node_modules/lucide-react/dist/esm/lucide-react.js'),
|
2026-08-08 07:21:04 +08:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
root: path.resolve(__dirname, '../guanghu-knowledge-base'),
|
|
|
|
|
server: {
|
|
|
|
|
port: 5180,
|
|
|
|
|
proxy: {
|
|
|
|
|
'/api': {
|
2026-08-09 10:43:56 +08:00
|
|
|
target: `http://localhost:${process.env.KB_PORT || '3890'}`,
|
2026-08-08 07:21:04 +08:00
|
|
|
changeOrigin: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
build: {
|
|
|
|
|
outDir: path.resolve(__dirname, 'dist'),
|
|
|
|
|
emptyOutDir: true,
|
|
|
|
|
sourcemap: true,
|
|
|
|
|
},
|
|
|
|
|
});
|