66 lines
1.2 KiB
TypeScript
66 lines
1.2 KiB
TypeScript
/**
|
|
* 性能优化配置
|
|
*/
|
|
import { defineConfig } from 'vite';
|
|
import react from '@vitejs/plugin-react';
|
|
import path from 'path';
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig({
|
|
plugins: [
|
|
react({
|
|
fastRefresh: true,
|
|
}),
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, './src'),
|
|
},
|
|
},
|
|
server: {
|
|
port: 3000,
|
|
proxy: {
|
|
'/api': {
|
|
target: 'http://localhost:8000',
|
|
changeOrigin: true,
|
|
},
|
|
},
|
|
hmr: {
|
|
overlay: true,
|
|
},
|
|
},
|
|
build: {
|
|
rollupOptions: {
|
|
output: {
|
|
manualChunks: {
|
|
'react-vendor': ['react', 'react-dom', 'react-router-dom'],
|
|
'antd-vendor': ['antd', '@ant-design/icons'],
|
|
'state-vendor': ['zustand', '@tanstack/react-query', 'axios'],
|
|
},
|
|
},
|
|
},
|
|
minify: 'esbuild',
|
|
sourcemap: false,
|
|
chunkSizeWarningLimit: 1000,
|
|
},
|
|
css: {
|
|
preprocessorOptions: {
|
|
less: {
|
|
javascriptEnabled: true,
|
|
},
|
|
},
|
|
},
|
|
optimizeDeps: {
|
|
include: [
|
|
'react',
|
|
'react-dom',
|
|
'react-router-dom',
|
|
'antd',
|
|
'@ant-design/icons',
|
|
'zustand',
|
|
'@tanstack/react-query',
|
|
'axios',
|
|
],
|
|
},
|
|
});
|