feat: Add environment configuration, ESLint setup, GitHub Actions deployment workflow, comprehensive API documentation, Jest testing configuration, and optimized Vite setup; implement AI model lazy loading and SEO components for improved performance and user experience
This commit is contained in:
61
vite.config.optimized.ts
Normal file
61
vite.config.optimized.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import react from '@vitejs/plugin-react'
|
||||
import { resolve } from 'path'
|
||||
|
||||
// Optimized Vite Configuration
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': resolve(__dirname, './src'),
|
||||
},
|
||||
},
|
||||
server: {
|
||||
port: 3000,
|
||||
open: true,
|
||||
},
|
||||
build: {
|
||||
outDir: 'dist',
|
||||
sourcemap: true,
|
||||
rollupOptions: {
|
||||
output: {
|
||||
manualChunks: {
|
||||
// Core React libraries
|
||||
vendor: ['react', 'react-dom'],
|
||||
|
||||
// UI and animations
|
||||
ui: ['framer-motion', 'lucide-react'],
|
||||
|
||||
// AI and ML libraries (largest chunk)
|
||||
ai: ['@tensorflow/tfjs', 'natural', 'ml-matrix', 'compromise'],
|
||||
|
||||
// Real-time and networking
|
||||
realtime: ['socket.io-client', 'ws', 'ioredis', 'redis'],
|
||||
|
||||
// Queue management
|
||||
queue: ['bull', 'uuid'],
|
||||
|
||||
// Date utilities
|
||||
utils: ['date-fns']
|
||||
},
|
||||
// Optimize chunk sizes
|
||||
chunkFileNames: (chunkInfo) => {
|
||||
const facadeModuleId = chunkInfo.facadeModuleId
|
||||
? chunkInfo.facadeModuleId.split('/').pop()
|
||||
: 'chunk'
|
||||
return `js/${facadeModuleId}-[hash].js`
|
||||
}
|
||||
},
|
||||
},
|
||||
// Enable compression
|
||||
minify: 'terser',
|
||||
terserOptions: {
|
||||
compress: {
|
||||
drop_console: true,
|
||||
drop_debugger: true,
|
||||
},
|
||||
},
|
||||
// Optimize chunks
|
||||
chunkSizeWarningLimit: 500,
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user