perf(config): improve performance with image optimization, caching headers, and build optimizations

- Add AVIF and WebP image formats for optimized delivery
- Configure cache headers for static assets (images, icons, SVGs)
- Enable server minification and optimize package imports
- Disable poweredByHeader and enable compression
- Remove unused radix-ui dependency
This commit is contained in:
Yusuf İpek
2026-02-14 17:15:35 +03:00
parent e4b29f5829
commit ea21d173b2
2 changed files with 47 additions and 1 deletions
+47
View File
@@ -9,6 +9,53 @@ const nextConfig: NextConfig = {
{ protocol: 'https', hostname: 'vumbnail.com' },
{ protocol: 'https', hostname: 'images.unsplash.com' },
],
formats: ['image/avif', 'image/webp'],
},
experimental: {
optimizePackageImports: ['lucide-react', 'radix-ui'],
serverMinification: true,
},
poweredByHeader: false,
compress: true,
async headers() {
return [
{
source: '/_next/static/:path*',
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=31536000, immutable',
},
],
},
{
source: '/images/:path*',
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=2592000',
},
],
},
{
source: '/:path*.ico',
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=604800',
},
],
},
{
source: '/:path*.svg',
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=2592000',
},
],
},
];
},
};