Files
portfolio/next.config.ts
denshooter 8ea4fc3fd3 Fix caching issues - disable static generation and add cache-busting headers
- Disable generateStaticParams to prevent static generation
- Add Cache-Control headers to force revalidation
- This should fix the issue where new routes are not available after deployment
2025-09-10 11:46:52 +02:00

71 lines
1.6 KiB
TypeScript

import type { NextConfig } from "next";
import dotenv from "dotenv";
import path from "path";
// Lade die .env Datei aus dem Arbeitsverzeichnis
dotenv.config({ path: path.resolve(__dirname, '.env') });
const nextConfig: NextConfig = {
// Enable standalone output for Docker
output: 'standalone',
// Optimize for production
compress: true,
poweredByHeader: false,
// Disable ESLint during build for Docker
eslint: {
ignoreDuringBuilds: process.env.NODE_ENV === 'production',
},
// Environment variables
env: {
NEXT_PUBLIC_BASE_URL: process.env.NEXT_PUBLIC_BASE_URL
},
serverRuntimeConfig: {
GHOST_API_URL: process.env.GHOST_API_URL,
GHOST_API_KEY: process.env.GHOST_API_KEY,
MY_EMAIL: process.env.MY_EMAIL,
MY_INFO_EMAIL: process.env.MY_INFO_EMAIL,
MY_PASSWORD: process.env.MY_PASSWORD,
MY_INFO_PASSWORD: process.env.MY_INFO_PASSWORD
},
// Performance optimizations
experimental: {
optimizePackageImports: ['lucide-react', 'framer-motion'],
},
// Image optimization
images: {
formats: ['image/webp', 'image/avif'],
minimumCacheTTL: 60,
},
// Disable static generation for dynamic routes
generateStaticParams: false,
// Add cache-busting headers
async headers() {
return [
{
source: '/(.*)',
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=0, must-revalidate',
},
],
},
];
},
};
import bundleAnalyzer from "@next/bundle-analyzer";
const withBundleAnalyzer = bundleAnalyzer({
enabled: process.env.ANALYZE === "true",
});
module.exports = withBundleAnalyzer(nextConfig);