Files
portifolio-evandrodevbr/next.config.ts
T
Evandro Fonseca Junior 8f096b9400 feat(config, layout): add analytics proxy and improve type handling
- Implemented a rewrite rule in the Next.js configuration to proxy analytics requests, bypassing adblockers for Rybbit Analytics.
- Enhanced the RootLayout component by correcting the typing of the children prop and improving the structure for better type safety.
2026-01-20 19:55:06 -03:00

75 lines
1.6 KiB
TypeScript

import type { NextConfig } from "next";
const nextConfig: NextConfig = {
// Otimização de imagens
images: {
formats: ["image/webp", "image/avif"],
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
minimumCacheTTL: 60,
},
// Otimizações de performance
experimental: {
scrollRestoration: true,
},
// Headers de cache e segurança
async headers(): Promise<
Array<{ source: string; headers: Array<{ key: string; value: string }> }>
> {
return [
{
source: "/(.*)",
headers: [
{
key: "X-Frame-Options",
value: "DENY",
},
{
key: "X-Content-Type-Options",
value: "nosniff",
},
{
key: "Referrer-Policy",
value: "origin-when-cross-origin",
},
],
},
{
source: "/static/(.*)",
headers: [
{
key: "Cache-Control",
value: "public, max-age=31536000, immutable",
},
],
},
{
source: "/_next/image(.*)",
headers: [
{
key: "Cache-Control",
value: "public, max-age=31536000, immutable",
},
],
},
];
},
// Proxy reverso para bypass de adblockers (Rybbit Analytics)
async rewrites() {
return [
{
source: "/analytics/:match*",
destination: "https://analytics.evandro.dev.br/:match*",
},
];
},
// Compressão
compress: true,
};
export default nextConfig;