import type { NextConfig } from "next"; import createNextIntlPlugin from "next-intl/plugin"; // Parse API URL to get hostname and port for images configuration const apiUrl = process.env.NEXT_PUBLIC_API_URL || "http://localhost:4242"; const apiUrlObj = new URL(apiUrl); const nextConfig: NextConfig = { env: { NEXT_PUBLIC_API_URL: process.env.NEXT_PUBLIC_API_URL, NEXT_PUBLIC_APP_URL: process.env.NEXT_PUBLIC_APP_URL, NEXT_PUBLIC_AUTH_REDIRECT_URL: process.env.NEXT_PUBLIC_AUTH_REDIRECT_URL, NEXT_PUBLIC_YM_ID: process.env.NEXT_PUBLIC_YM_ID, }, images: { remotePatterns: [ { protocol: "https", hostname: "aura-node.s3.eu-west-2.amazonaws.com", pathname: "/**", }, { protocol: "https", hostname: "assets.witlab.us", pathname: "/**", }, { protocol: apiUrlObj.protocol.replace(":", "") as "http" | "https", hostname: apiUrlObj.hostname, ...(apiUrlObj.port && { port: apiUrlObj.port }), pathname: "/**", }, ], }, turbopack: { rules: { "*.svg": { loaders: ["@svgr/webpack"], as: "*.js", }, }, }, }; const withNextIntl = createNextIntlPlugin(); export default withNextIntl(nextConfig);