34 lines
998 B
TypeScript
34 lines
998 B
TypeScript
import react from '@vitejs/plugin-react'
|
|
import { defineConfig } from 'vite'
|
|
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
server: {
|
|
port: 5173,
|
|
host: true,
|
|
proxy: {
|
|
'/api': { target: 'http://127.0.0.1:8000', changeOrigin: true },
|
|
'/uploads': { target: 'http://127.0.0.1:8000', changeOrigin: true },
|
|
},
|
|
},
|
|
build: {
|
|
chunkSizeWarningLimit: 2400,
|
|
sourcemap: false,
|
|
reportCompressedSize: false,
|
|
rollupOptions: {
|
|
output: {
|
|
// 手动分包:把体量最大的几个依赖拆开,配合路由级 lazy 让首屏只下载必要代码
|
|
manualChunks: {
|
|
react: ['react', 'react-dom', 'react-router-dom'],
|
|
data: ['@tanstack/react-query', 'zustand', 'axios'],
|
|
antd: ['antd'],
|
|
icons: ['@ant-design/icons'],
|
|
'antd-mobile': ['antd-mobile'],
|
|
charts: ['recharts'],
|
|
dnd: ['@dnd-kit/core', '@dnd-kit/sortable', '@dnd-kit/utilities'],
|
|
},
|
|
},
|
|
},
|
|
},
|
|
})
|