1+ import { withSentryConfig } from '@sentry/nextjs' ;
2+ import dotenv from 'dotenv' ;
3+ dotenv . config ( { path : '.env.local' } ) ;
4+
5+ const nextConfig = {
6+ reactStrictMode : true , // Temporarily disabled for testing
7+
8+ // Enable response compression for better performance
9+ compress : true ,
10+
11+ // Performance optimizations
12+ poweredByHeader : false , // Remove X-Powered-By header for security and performance
13+
14+ // Build optimizations (swcMinify is now default in Next.js 15)
15+
16+ images : {
17+ // Enable modern image formats for better compression
18+ formats : [ 'image/avif' , 'image/webp' ] ,
19+
20+ // Allowed remote image sources (domains is deprecated)
21+ remotePatterns : process . env . BLOB_STORAGE_HOSTNAME
22+ ? [
23+ {
24+ protocol : 'https' ,
25+ hostname : process . env . BLOB_STORAGE_HOSTNAME ,
26+ pathname : '/**' ,
27+ } ,
28+ ]
29+ : [ ] ,
30+
31+ // Device sizes for responsive images
32+ deviceSizes : [ 640 , 750 , 828 , 1080 , 1200 , 1920 , 2048 ] ,
33+
34+ // Image sizes for different breakpoints
35+ imageSizes : [ 16 , 32 , 48 , 64 , 96 , 128 , 256 , 384 ] ,
36+
37+ // Minimize layout shift by enforcing size requirements
38+ minimumCacheTTL : 60 ,
39+ } ,
40+
41+ // Enable experimental features for better performance
42+ experimental : {
43+ // Optimize server components
44+ optimizeServerReact : true ,
45+ } ,
46+
47+ // Turbopack configuration (moved from experimental.turbo)
48+ turbopack : {
49+ resolveAlias : {
50+ // Reduce bundle size by aliasing large dependencies
51+ 'react-icons/lib' : 'react-icons' ,
52+ } ,
53+ } ,
54+
55+ // Production optimizations
56+ ...( process . env . NODE_ENV === 'production' && {
57+ output : 'standalone' , // Optimize for deployment
58+
59+ // Webpack optimizations
60+ webpack : ( config : any ) => {
61+ // Enable module concatenation for smaller bundles
62+ config . optimization = {
63+ ...config . optimization ,
64+ usedExports : true ,
65+ sideEffects : false ,
66+
67+ // Split chunks for better caching
68+ splitChunks : {
69+ ...config . optimization ?. splitChunks ,
70+ chunks : 'all' ,
71+ cacheGroups : {
72+ ...config . optimization ?. splitChunks ?. cacheGroups ,
73+ // Separate vendor chunks
74+ vendor : {
75+ test : / [ \\ / ] n o d e _ m o d u l e s [ \\ / ] / ,
76+ name : 'vendors' ,
77+ chunks : 'all' ,
78+ priority : 10 ,
79+ } ,
80+ } ,
81+ }
82+ } ;
83+
84+ return config ;
85+ } ,
86+ } ) ,
87+ } ;
88+
89+ export default withSentryConfig ( nextConfig , {
90+ // For all available options, see:
91+ // https://www.npmjs.com/package/@sentry /webpack-plugin#options
92+
93+ org : process . env . SENTRY_ORG ,
94+
95+ project : process . env . SENTRY_PROJECT ,
96+
97+ // Only print logs for uploading source maps in CI
98+ silent : ! process . env . CI ,
99+
100+ // For all available options, see:
101+ // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
102+
103+ // Upload a larger set of source maps for prettier stack traces (increases build time)
104+ widenClientFileUpload : true ,
105+
106+ // Uncomment to route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.
107+ // This can increase your server load as well as your hosting bill.
108+ // Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-
109+ // side errors will fail.
110+ // tunnelRoute: "/monitoring",
111+
112+ // Automatically tree-shake Sentry logger statements to reduce bundle size
113+ disableLogger : true ,
114+
115+ // Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)
116+ // See the following for more information:
117+ // https://docs.sentry.io/product/crons/
118+ // https://vercel.com/docs/cron-jobs
119+ automaticVercelMonitors : true ,
120+ } ) ;
0 commit comments