fix alot of things

This commit is contained in:
NotII
2025-03-14 16:48:08 +00:00
parent c15e8119c7
commit 87a58a6736
17 changed files with 79 additions and 3102 deletions

View File

@@ -8,46 +8,6 @@ const nextConfig = {
},
],
},
// Disable Next.js handling of API routes that our Express server will handle
async rewrites() {
return [
{
// Don't rewrite actual Next.js API routes
source: "/api/_next/:path*",
destination: "/api/_next/:path*",
},
{
// Rewrite API requests to be handled by our custom Express server
source: "/api/:path*",
destination: "/api/:path*",
},
];
},
// Make environment variables available to both client and server components
env: {
// For integrated backend, use http://localhost:3000/api
NEXT_PUBLIC_API_URL: process.env.NEXT_PUBLIC_API_URL || 'http://localhost:3000/api',
},
// Prevent dynamic URLs from being hard-coded at build time
// This is important for Tor compatibility
experimental: {
// This prevents URLs from being hardcoded at build time
esmExternals: true,
},
// Ensure server components can handle URL objects
serverComponentsExternalPackages: ['next/dist/compiled/path-to-regexp'],
// Allow server-side fetch calls to the local API
serverRuntimeConfig: {
apiUrl: 'http://localhost:3000/api',
},
// Special handling for server components
webpack: (config, { isServer }) => {
if (isServer) {
// Server-side specific config
}
return config;
},
};
export default nextConfig;