perf: Optimize PageSpeed performance score
- Replace 2.2MB social-preview.svg with lightweight 1KB vector SVG - Remove lucide-react manual chunk (rely on tree-shaking instead) - Separate react-router-dom into its own 'router' chunk - Add build.target es2020 and chunkSizeWarningLimit - Add modulepreload hint for main entry point - Google Fonts already uses media=print non-blocking pattern - i18n already lazy-loads ar/fr dynamically - AdSlot already loads AdSense dynamically with intersection observer Expected improvement: 34 → 70+ on mobile PageSpeed
This commit is contained in:
@@ -50,6 +50,9 @@ export default defineConfig({
|
||||
outDir: 'dist',
|
||||
sourcemap: false,
|
||||
cssMinify: true,
|
||||
target: 'es2020',
|
||||
chunkSizeWarningLimit: 600,
|
||||
minify: 'esbuild',
|
||||
rollupOptions: {
|
||||
output: {
|
||||
manualChunks(id) {
|
||||
@@ -57,14 +60,14 @@ export default defineConfig({
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (
|
||||
id.includes('react-dom') ||
|
||||
id.includes('react-router-dom') ||
|
||||
id.includes('/react/')
|
||||
) {
|
||||
if (id.includes('react-dom') || id.includes('/react/')) {
|
||||
return 'vendor';
|
||||
}
|
||||
|
||||
if (id.includes('react-router-dom')) {
|
||||
return 'router';
|
||||
}
|
||||
|
||||
if (id.includes('i18next') || id.includes('react-i18next')) {
|
||||
return 'i18n';
|
||||
}
|
||||
@@ -73,10 +76,6 @@ export default defineConfig({
|
||||
return 'helmet';
|
||||
}
|
||||
|
||||
if (id.includes('lucide-react')) {
|
||||
return 'icons';
|
||||
}
|
||||
|
||||
if (id.includes('/axios/')) {
|
||||
return 'network';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user