feature: localization's first implmentation
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
import type { NextConfig } from "next";
|
||||
import type { NextConfig } from 'next';
|
||||
import createNextIntlPlugin from 'next-intl/plugin';
|
||||
|
||||
const withNextIntl = createNextIntlPlugin('./src/i18n/request.ts');
|
||||
|
||||
function publicAppHostname(): string | null {
|
||||
const url = process.env.NEXT_PUBLIC_APP_URL;
|
||||
@@ -12,41 +15,29 @@ function publicAppHostname(): string | null {
|
||||
|
||||
const appHost = publicAppHostname();
|
||||
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
// Enable React strict mode
|
||||
const nextConfig: NextConfig = {
|
||||
reactStrictMode: true,
|
||||
|
||||
// Disable x-powered-by header for security
|
||||
poweredByHeader: false,
|
||||
|
||||
// Configure allowed remote image sources (hostname derived from NEXT_PUBLIC_APP_URL at build time)
|
||||
images: {
|
||||
remotePatterns: [
|
||||
{ protocol: "http", hostname: "localhost" },
|
||||
{ protocol: 'http', hostname: 'localhost' },
|
||||
...(appHost
|
||||
? [
|
||||
{ protocol: "http" as const, hostname: appHost },
|
||||
{ protocol: "https" as const, hostname: appHost },
|
||||
{ protocol: 'http' as const, hostname: appHost },
|
||||
{ protocol: 'https' as const, hostname: appHost },
|
||||
]
|
||||
: []),
|
||||
{ protocol: "https", hostname: "dyolink.com" },
|
||||
{ protocol: "https", hostname: "www.dyolink.com" },
|
||||
{ protocol: 'https', hostname: 'dyolink.com' },
|
||||
{ protocol: 'https', hostname: 'www.dyolink.com' },
|
||||
],
|
||||
},
|
||||
|
||||
// Environment variables that will be available at build time
|
||||
env: {
|
||||
NEXT_PUBLIC_APP_NAME: process.env.NEXT_PUBLIC_APP_NAME,
|
||||
NEXT_PUBLIC_APP_URL: process.env.NEXT_PUBLIC_APP_URL,
|
||||
NEXT_PUBLIC_API_URL: process.env.NEXT_PUBLIC_API_URL,
|
||||
},
|
||||
|
||||
// Output configuration
|
||||
output: 'standalone', // Reduces Docker image size
|
||||
|
||||
// Compress with gzip
|
||||
output: 'standalone',
|
||||
compress: true,
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = nextConfig
|
||||
export default withNextIntl(nextConfig);
|
||||
|
||||
Reference in New Issue
Block a user