Files
fast-next-template/frontend/next.config.ts
Felipe Cardoso 1b9854d412 Performance optimizations: Bundle size reduction
Optimizations implemented:
1. Font display: swap + preload for critical fonts
2. ReactQueryDevtools: Lazy load in dev only, exclude from production
3. Auth forms code splitting: LoginForm, PasswordResetRequestForm
4. Remove invalid swcMinify option (default in Next.js 15)

Results:
- Login page: 178 kB → 104 kB (74 kB saved, 42% reduction)
- Password reset: 178 kB → 104 kB (74 kB saved, 42% reduction)
- Homepage: 108 kB (baseline 102 kB shared + 6 kB page)

Remaining issue:
- 102 kB baseline shared by all pages (React Query + Auth loaded globally)
2025-11-02 16:16:13 +01:00

29 lines
759 B
TypeScript
Executable File

import type { NextConfig } from "next";
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
};
// Enable bundle analyzer when ANALYZE=true
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
});
export default withBundleAnalyzer(nextConfig);