import { fileURLToPath } from 'url'; import createJiti from 'jiti'; import * as i18nConfig from './next-i18next.config.js'; createJiti(fileURLToPath(import.meta.url))('./src/env'); /** @type {import('next').NextConfig} */ const nextConfig = { i18n: i18nConfig.default.i18n, output: 'standalone', typescript: { ignoreBuildErrors: true }, transpilePackages: ['@ufb/react'], compiler: { removeConsole: process.env.NODE_ENV === 'production' }, images: { remotePatterns: [{ hostname: '*' }] }, devIndicators: false, async redirects() { return [ { source: '/demo/feedback-writer', destination: '/support/INTRA_GENERAL_QNA/new', permanent: false, }, { source: '/demo/feedback-list', destination: '/support/INTRA_GENERAL_QNA', permanent: false, }, { source: '/demo/feedback/:feedbackId', destination: '/support/INTRA_GENERAL_QNA', permanent: false, }, ]; }, async rewrites() { const internalApiBaseUrl = process.env.INTERNAL_API_BASE_URL ?? 'http://api:4000'; const secretaryApiBaseUrl = process.env.SUPPORT_API_BASE_URL ?? (process.env.NODE_ENV === 'development' ? 'http://127.0.0.1:8010' : 'http://secretary-api:8010'); return { fallback: [ // Swagger is served by the Nest API, while the public staging // hostname terminates at this Next.js web container. Keep the API // port private and proxy the documentation through the web service. { source: '/docs', destination: `${internalApiBaseUrl}/docs`, }, { source: '/docs/:path*', destination: `${internalApiBaseUrl}/docs/:path*`, }, { source: '/admin-docs', destination: `${internalApiBaseUrl}/admin-docs`, }, { source: '/admin-docs/:path*', destination: `${internalApiBaseUrl}/admin-docs/:path*`, }, { source: '/docs-json', destination: `${internalApiBaseUrl}/docs-json`, }, { source: '/admin-docs-json', destination: `${internalApiBaseUrl}/admin-docs-json`, }, { source: '/secretary-docs', destination: `${secretaryApiBaseUrl}/docs`, }, { source: '/secretary-docs/:path*', destination: `${secretaryApiBaseUrl}/:path*`, }, { source: '/secretary-docs-json', destination: `${secretaryApiBaseUrl}/openapi.json`, }, { source: '/api/:path*', destination: `${internalApiBaseUrl}/api/:path*`, }, ], }; }, }; export default nextConfig;