From 235742998dfc85aa8b83f9422b0f4d337973f196 Mon Sep 17 00:00:00 2001 From: Dorseuil Nicolas Date: Tue, 20 Feb 2024 23:47:19 +0100 Subject: [PATCH] fix fallback false for route without i18n --- packages/open-next/src/core/routing/matcher.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/open-next/src/core/routing/matcher.ts b/packages/open-next/src/core/routing/matcher.ts index dc061d80..95a308a1 100644 --- a/packages/open-next/src/core/routing/matcher.ts +++ b/packages/open-next/src/core/routing/matcher.ts @@ -289,7 +289,9 @@ export function handleFallbackFalse( }); const locales = NextConfig.i18n?.locales; const routesAlreadyHaveLocale = - locales !== undefined && locales.includes(rawPath.split("/")[1]); + (locales !== undefined && locales.includes(rawPath.split("/")[1])) || + // If we don't use locales, we don't need to add the default locale + locales === undefined; const localizedPath = routesAlreadyHaveLocale ? rawPath : `/${NextConfig.i18n?.defaultLocale}${rawPath}`;