feat: enhance tool loading and performance optimization

- Added DNS prefetch and preconnect links in index.html for improved API loading times.
- Implemented lazy loading for tool components to optimize performance and reduce initial load time.
- Wrapped tool components in Suspense with a loading fallback to enhance user experience during loading.
- Refactored Vite configuration to create manual chunks for better code splitting of React and UI libraries.
This commit is contained in:
typist
2025-10-29 08:49:25 +08:00
parent 55207beff5
commit 59f998e8e3
5 changed files with 66 additions and 21 deletions

View File

@@ -11,4 +11,27 @@ export default defineConfig({
"@": path.resolve(__dirname, "./src"),
},
},
build: {
rollupOptions: {
output: {
manualChunks: (id) => {
// React核心库
if (id.includes('node_modules/react') ||
id.includes('node_modules/react-dom') ||
id.includes('node_modules/react-router-dom')) {
return 'react-vendor';
}
// Radix UI组件
if (id.includes('node_modules/@radix-ui')) {
return 'ui-vendor';
}
// 图标库
if (id.includes('node_modules/lucide-react')) {
return 'icons';
}
},
},
},
chunkSizeWarningLimit: 500,
},
})