more
This commit is contained in:
@@ -66,90 +66,6 @@ export default defineConfig(({ mode }) => {
|
||||
marketing: resolve(__dirname, "marketing.html"),
|
||||
},
|
||||
output: {
|
||||
// Manual chunk splitting for better code splitting
|
||||
manualChunks: (id) => {
|
||||
// Vendor chunks - separate large dependencies for better caching
|
||||
if (id.includes('node_modules')) {
|
||||
// React core (most critical, always needed)
|
||||
if (id.includes('react/') || id.includes('react-dom/')) {
|
||||
return 'vendor-react-core';
|
||||
}
|
||||
// React Router (separate chunk - only loads on navigation)
|
||||
if (id.includes('react-router')) {
|
||||
return 'vendor-react-router';
|
||||
}
|
||||
// Heavy chart libraries (only used in specific pages)
|
||||
if (id.includes('apexcharts') || id.includes('react-apexcharts')) {
|
||||
return 'vendor-charts';
|
||||
}
|
||||
// Calendar libraries (only used in Calendar page)
|
||||
if (id.includes('@fullcalendar')) {
|
||||
return 'vendor-calendar';
|
||||
}
|
||||
// Map libraries (only used in specific pages)
|
||||
if (id.includes('@react-jvectormap')) {
|
||||
return 'vendor-maps';
|
||||
}
|
||||
// Drag and drop (only used in specific pages)
|
||||
if (id.includes('react-dnd')) {
|
||||
return 'vendor-dnd';
|
||||
}
|
||||
// Swiper (only used in specific pages)
|
||||
if (id.includes('swiper')) {
|
||||
return 'vendor-swiper';
|
||||
}
|
||||
// UI libraries (Radix UI, etc.)
|
||||
if (id.includes('@radix-ui') || id.includes('framer-motion')) {
|
||||
return 'vendor-ui';
|
||||
}
|
||||
// Zustand (state management - used everywhere)
|
||||
if (id.includes('zustand')) {
|
||||
return 'vendor-state';
|
||||
}
|
||||
// React Helmet (SEO)
|
||||
if (id.includes('react-helmet')) {
|
||||
return 'vendor-helmet';
|
||||
}
|
||||
// Other vendors (smaller libraries)
|
||||
return 'vendor-other';
|
||||
}
|
||||
// Page chunks - each page gets its own chunk
|
||||
if (id.includes('/pages/')) {
|
||||
const match = id.match(/\/pages\/([^/]+)/);
|
||||
if (match) {
|
||||
const pageName = match[1];
|
||||
// Group by module for better caching
|
||||
if (pageName === 'Planner' || id.includes('/Planner/')) {
|
||||
return 'pages-planner';
|
||||
}
|
||||
if (pageName === 'Writer' || id.includes('/Writer/')) {
|
||||
return 'pages-writer';
|
||||
}
|
||||
if (pageName === 'Thinker' || id.includes('/Thinker/')) {
|
||||
return 'pages-thinker';
|
||||
}
|
||||
if (pageName === 'Settings' || id.includes('/Settings/')) {
|
||||
return 'pages-settings';
|
||||
}
|
||||
if (pageName === 'Billing' || id.includes('/Billing/')) {
|
||||
return 'pages-billing';
|
||||
}
|
||||
// Individual page chunks for others
|
||||
return `page-${pageName.toLowerCase()}`;
|
||||
}
|
||||
}
|
||||
if (id.includes('/marketing/')) {
|
||||
const match = id.match(/\/marketing\/([^/]+)/);
|
||||
if (match) {
|
||||
const sectionName = match[1];
|
||||
return `marketing-${sectionName.toLowerCase()}`;
|
||||
}
|
||||
}
|
||||
// Split icons into separate chunk (lazy load)
|
||||
if (id.includes('/icons/') && id.endsWith('.svg')) {
|
||||
return 'icons';
|
||||
}
|
||||
},
|
||||
// Optimize chunk file names
|
||||
chunkFileNames: 'assets/js/[name]-[hash].js',
|
||||
entryFileNames: 'assets/js/[name]-[hash].js',
|
||||
|
||||
Reference in New Issue
Block a user