import type { NextConfig } from "next"; /** Subpath deploy (e.g. /punim-viewer). Omit or empty for local dev at /. */ function normalizeNextBasePath(raw: string): string { const t = raw.trim().replace(/\/+$/, ""); if (!t) { return ""; } return t.startsWith("/") ? t : `/${t}`; } const nextBasePath = normalizeNextBasePath(process.env.NEXT_BASE_PATH || ""); const nextConfig: NextConfig = { ...(nextBasePath ? { basePath: nextBasePath } : {}), images: { // Configure remote patterns for external image sources (SharePoint, CDN, etc.) remotePatterns: [ // SharePoint Online (Microsoft 365) { protocol: 'https', hostname: '**.sharepoint.com', }, // SharePoint Server (on-premises) - update with your domain // Uncomment and update if using on-premises SharePoint: // { // protocol: 'https', // hostname: 'sharepoint.yourcompany.com', // }, // Add other CDN or image hosting domains as needed ], // Enable image optimization in production // In development, images are unoptimized for faster iteration unoptimized: process.env.NODE_ENV === 'development', }, }; export default nextConfig;