This commit is contained in:
2026-04-29 19:05:47 +08:00
parent b98c66ca21
commit 88c2fa5d03
40 changed files with 1781 additions and 2068 deletions
+48 -16
View File
@@ -1,19 +1,51 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
// https://vitejs.dev/config/
export default defineConfig({
export default defineConfig(({ command }) => ({
plugins: [react()],
server:{
proxy:{
//此处编写代理规则
"/api":{
target:"http://localhost:8080",
changeOrigin:true,
rewrite:path=>{
return path.replace(/\/api/,'api/');
}
}
}
}
})
resolve: {
// new URL is pure ESM — no __dirname needed, no @types/node required
alias: { '@': new URL('./src', import.meta.url).pathname },
},
css: {
preprocessorOptions: {
scss: {
api: 'modern-compiler',
},
},
},
server: {
proxy: {
'/api': {
target: 'http://localhost:8080',
changeOrigin: true,
// no rewrite: /api/... proxied as-is to http://localhost:8080/api/...
},
},
},
build: {
rollupOptions: {
output: {
manualChunks: {
lexical: [
'lexical',
'@lexical/react',
'@lexical/rich-text',
'@lexical/list',
'@lexical/code',
'@lexical/table',
],
semi: ['@douyinfe/semi-ui', '@douyinfe/semi-icons'],
excalidraw: ['@excalidraw/excalidraw'],
vendor: ['react', 'react-dom', 'react-router', 'axios'],
yjs: ['yjs', 'y-websocket'],
},
},
},
},
esbuild: {
// strip console.* and debugger in production builds
drop: command === 'build' ? (['console', 'debugger'] as const) : [],
},
}));