Files
manoon-headless/next.config.ts
Unchained 6843d2db36
Some checks failed
Build and Deploy / build (push) Has been cancelled
fix(404): add redirects for broken URLs and custom not-found page
- Add permanent redirects for /products/manoon to /products
- Strip malformed /contact suffix from product URLs
- Create custom branded 404 page with product navigation
- Add NotFound translations for en and sr locales
2026-04-01 10:24:09 +02:00

97 lines
2.4 KiB
TypeScript

import createNextIntlPlugin from "next-intl/plugin";
import type { NextConfig } from "next";
const withNextIntl = createNextIntlPlugin();
const nextConfig: NextConfig = {
output: 'standalone',
async redirects() {
return [
// Fix malformed URLs with /contact appended to product slugs
{
source: '/:locale(en|sr)/products/:slug*/contact',
destination: '/:locale/products/:slug*',
permanent: true,
},
{
source: '/products/:slug*/contact',
destination: '/products/:slug*',
permanent: true,
},
// Redirect old/removed product "manoon" to products listing
{
source: '/:locale(en|sr)/products/manoon',
destination: '/:locale/products',
permanent: true,
},
{
source: '/products/manoon',
destination: '/products',
permanent: true,
},
];
},
async rewrites() {
const rybbitHost = process.env.NEXT_PUBLIC_RYBBIT_HOST || "https://rybbit.nodecrew.me";
return [
{
source: "/api/script.js",
destination: `${rybbitHost}/api/script.js`,
},
{
source: "/api/track",
destination: "/api/rybbit/track",
},
{
source: "/api/site/tracking-config/:id",
destination: `${rybbitHost}/api/site/tracking-config/:id`,
},
{
source: "/api/replay.js",
destination: `${rybbitHost}/api/replay.js`,
},
{
source: "/api/session-replay/record/:id",
destination: `${rybbitHost}/api/session-replay/record/:id`,
},
];
},
images: {
formats: ["image/avif", "image/webp"],
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048],
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
remotePatterns: [
{
protocol: "https",
hostname: "manoonoils.com",
pathname: "/**",
},
{
protocol: "https",
hostname: "minio-api.nodecrew.me",
pathname: "/**",
},
{
protocol: "https",
hostname: "api.manoonoils.com",
pathname: "/**",
},
{
protocol: "https",
hostname: "**.saleor.cloud",
pathname: "/**",
},
{
protocol: "https",
hostname: "images.unsplash.com",
pathname: "/**",
},
],
},
experimental: {
optimizePackageImports: ["lucide-react", "framer-motion", "clsx", "motion"],
},
};
export default withNextIntl(nextConfig);