11import type { NextConfig } from 'next' ;
2- import path from 'path' ;
32import './src/env.mjs' ;
43
54const config : NextConfig = {
6- // Use S3 bucket for static assets with app-specific path
7- assetPrefix : process . env . NODE_ENV === 'production' ? `${ process . env . STATIC_ASSETS_URL } /app` : '' ,
8- // Ensure fallback to local assets if CDN fails
9- generateEtags : false ,
105 poweredByHeader : false ,
116 reactStrictMode : true ,
127 transpilePackages : [ '@trycompai/db' ] ,
13- turbopack : {
14- resolveAlias : {
15- underscore : 'lodash' ,
16- } ,
17- } ,
8+
189 images : {
1910 remotePatterns : [
2011 {
@@ -23,15 +14,10 @@ const config: NextConfig = {
2314 } ,
2415 ] ,
2516 } ,
26- logging : {
27- fetches : {
28- fullUrl : process . env . LOG_FETCHES === 'true' ,
29- } ,
30- } ,
17+
3118 experimental : {
3219 serverActions : {
3320 bodySizeLimit : '15mb' ,
34- // Ensure server actions are stable across builds
3521 allowedOrigins :
3622 process . env . NODE_ENV === 'production'
3723 ? ( [ process . env . NEXT_PUBLIC_PORTAL_URL , 'https://app.trycomp.ai' ] . filter (
@@ -40,114 +26,10 @@ const config: NextConfig = {
4026 : undefined ,
4127 } ,
4228 authInterrupts : true ,
43- // Improve build stability
4429 optimizePackageImports : [ '@trycompai/db' , '@trycompai/ui' ] ,
4530 } ,
46- outputFileTracingRoot : path . join ( __dirname , '../../' ) ,
47- outputFileTracingIncludes : {
48- '/api/**/*' : [ './node_modules/.prisma/client/**/*' ] ,
49- // Ensure server actions are properly traced
50- '/**/*' : [ './src/actions/**/*' , './node_modules/.prisma/client/**/*' ] ,
51- } ,
52- async headers ( ) {
53- return [
54- {
55- // Super permissive CORS for all API routes
56- source : '/api/:path*' ,
57- headers : [
58- {
59- key : 'Access-Control-Allow-Origin' ,
60- value : '*' ,
61- } ,
62- {
63- key : 'Access-Control-Allow-Methods' ,
64- value : 'GET, POST, PUT, DELETE, PATCH, OPTIONS' ,
65- } ,
66- {
67- key : 'Access-Control-Allow-Headers' ,
68- value : 'Content-Type, Authorization, X-Requested-With, Accept, Origin, x-pathname' ,
69- } ,
70- {
71- key : 'Access-Control-Max-Age' ,
72- value : '86400' ,
73- } ,
74- ] ,
75- } ,
76- {
77- // Prevent caching of server action POST requests
78- source : '/(.*)' ,
79- has : [
80- {
81- type : 'header' ,
82- key : 'Next-Action' ,
83- } ,
84- ] ,
85- headers : [
86- {
87- key : 'Cache-Control' ,
88- value : 'no-cache, no-store, must-revalidate' ,
89- } ,
90- {
91- key : 'Pragma' ,
92- value : 'no-cache' ,
93- } ,
94- {
95- key : 'Expires' ,
96- value : '0' ,
97- } ,
98- ] ,
99- } ,
100- {
101- // Apply security headers to all routes
102- source : '/(.*)' ,
103- headers : [
104- {
105- key : 'X-DNS-Prefetch-Control' ,
106- value : 'on' ,
107- } ,
108- {
109- key : 'X-Frame-Options' ,
110- value : 'SAMEORIGIN' ,
111- } ,
112- {
113- key : 'X-Content-Type-Options' ,
114- value : 'nosniff' ,
115- } ,
116- {
117- key : 'Referrer-Policy' ,
118- value : 'origin-when-cross-origin' ,
119- } ,
120- ] ,
121- } ,
122- ] ;
123- } ,
124- async redirects ( ) {
125- if ( process . env . NODE_ENV === 'production' && process . env . STATIC_ASSETS_URL ) {
126- return [
127- {
128- source : '/favicon.ico' ,
129- destination : `${ process . env . STATIC_ASSETS_URL } /app/favicon.ico` ,
130- permanent : true ,
131- } ,
132- {
133- source : '/favicon-96x96.png' ,
134- destination : `${ process . env . STATIC_ASSETS_URL } /app/favicon-96x96.png` ,
135- permanent : true ,
136- } ,
137- {
138- source : '/apple-touch-icon.png' ,
139- destination : `${ process . env . STATIC_ASSETS_URL } /app/apple-touch-icon.png` ,
140- permanent : true ,
141- } ,
142- {
143- source : '/site.webmanifest' ,
144- destination : `${ process . env . STATIC_ASSETS_URL } /app/site.webmanifest` ,
145- permanent : true ,
146- } ,
147- ] ;
148- }
149- return [ ] ;
150- } ,
31+
32+ // PostHog proxy for better tracking
15133 async rewrites ( ) {
15234 return [
15335 {
@@ -164,10 +46,6 @@ const config: NextConfig = {
16446 } ,
16547 ] ;
16648 } ,
167- skipTrailingSlashRedirect : true ,
16849} ;
16950
170- // Always use standalone output
171- config . output = 'standalone' ;
172-
17351export default config ;
0 commit comments