forked from cardosofelipe/fast-next-template
- Integrated `next-intl` for server-side and client-side i18n support. - Added English (`en.json`) and Italian (`it.json`) localization files. - Configured routing with locale-based subdirectories (`/[locale]/path`) using `next-intl`. - Introduced type-safe i18n utilities and TypeScript definitions for translation keys. - Updated middleware to handle locale detection and routing. - Implemented dynamic translation loading to reduce bundle size. - Enhanced developer experience with auto-complete and compile-time validation for i18n keys.
30 lines
754 B
TypeScript
Executable File
30 lines
754 B
TypeScript
Executable File
import type { NextConfig } from 'next';
|
|
import createNextIntlPlugin from 'next-intl/plugin';
|
|
|
|
// Initialize next-intl plugin with i18n request config path
|
|
const withNextIntl = createNextIntlPlugin('./src/i18n/request.ts');
|
|
|
|
const nextConfig: NextConfig = {
|
|
output: 'standalone',
|
|
// Ensure we can connect to the backend in Docker
|
|
async rewrites() {
|
|
return [
|
|
{
|
|
source: '/api/:path*',
|
|
destination: 'http://backend:8000/:path*',
|
|
},
|
|
];
|
|
},
|
|
// ESLint configuration
|
|
eslint: {
|
|
ignoreDuringBuilds: false,
|
|
dirs: ['src'],
|
|
},
|
|
// Production optimizations
|
|
reactStrictMode: true,
|
|
// Note: swcMinify is default in Next.js 15
|
|
};
|
|
|
|
// Wrap config with next-intl plugin
|
|
export default withNextIntl(nextConfig);
|