w-lab-app/next.config.ts
dev.daminik00 f2d3e68f5d add ym env
2025-10-31 22:30:52 +01:00

47 lines
1.2 KiB
TypeScript

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);