11import type { NextConfig } from "next" ;
22
3+ // Bundle analyzer for monitoring code splitting
4+ const withBundleAnalyzer = require ( "@next/bundle-analyzer" ) ( {
5+ enabled : process . env . ANALYZE === "true" ,
6+ } ) ;
7+
38const nextConfig : NextConfig = {
49 images : {
510 remotePatterns : [
@@ -10,6 +15,15 @@ const nextConfig: NextConfig = {
1015 ] ,
1116 // Optimize images for faster loading
1217 formats : [ "image/avif" , "image/webp" ] ,
18+ // Enable image optimization
19+ deviceSizes : [ 640 , 750 , 828 , 1080 , 1200 , 1920 , 2048 , 3840 ] ,
20+ imageSizes : [ 16 , 32 , 48 , 64 , 96 , 128 , 256 , 384 ] ,
21+ // Minimize quality for faster loading
22+ minimumCacheTTL : 60 ,
23+ // Use sharp for better performance
24+ dangerouslyAllowSVG : true ,
25+ contentDispositionType : "attachment" ,
26+ contentSecurityPolicy : "default-src 'self'; script-src 'none'; sandbox;" ,
1327 } ,
1428 headers : async ( ) => {
1529 return [
@@ -62,6 +76,11 @@ const nextConfig: NextConfig = {
6276 } ,
6377 ] ;
6478 } ,
79+ // Enable experimental optimizations
80+ experimental : {
81+ // Optimize package imports to reduce bundle size
82+ optimizePackageImports : [ "lucide-react" , "@radix-ui/react-icons" ] ,
83+ } ,
6584} ;
6685
67- export default nextConfig ;
86+ export default withBundleAnalyzer ( nextConfig ) ;
0 commit comments