import type { NextConfig } from "next"; import { withSentryConfig } from "@sentry/nextjs"; const nextConfig: NextConfig = { // The end-to-end tests run their own dev server; a separate build folder keeps it // from clashing with one already running. distDir: process.env.NEXT_DIST_DIR || ".next", images: { // (images.domains is deprecated in Next 16.) remotePatterns: [{ protocol: 'https', hostname: 'images.unsplash.com' }], }, compiler: { removeConsole: process.env.NODE_ENV === 'production', }, // The end-to-end tests only (3.0.0): the site and its API on one address, as nginx does on a // server, so Accounts' sign-in comes back to /api/auth/callback. Unset everywhere else. ...(process.env.E2E_API_PROXY ? { async rewrites() { return [{ source: '/api/:path*', destination: `${process.env.E2E_API_PROXY}/api/:path*` }]; } } : {}), }; // A no-op wrap when SENTRY_DSN isn't configured for this deployment — safe in // every environment (dev, or a fresh deploy that hasn't set up Sentry yet). export default process.env.NEXT_PUBLIC_SENTRY_DSN ? withSentryConfig(nextConfig, { silent: true, disableLogger: true }) : nextConfig;