Skip to content
This repository was archived by the owner on May 10, 2021. It is now read-only.

Commit 2ae9f7d

Browse files
fix: next 10.0.6 changed prerender-manifest for i18n (#163)
1 parent 6e5c09d commit 2ae9f7d

File tree

5 files changed

+360
-1706
lines changed

5 files changed

+360
-1706
lines changed

Diff for: lib/helpers/getPrerenderManifest.js

+10-9
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,16 @@ const transformManifestForI18n = (manifest) => {
1414
if (isDynamicRoute) {
1515
newRoutes[route] = routes[route];
1616
} else {
17-
locales.forEach((locale) => {
18-
const routeWithPrependedLocale =
19-
route === "/" ? `/${locale}` : `/${locale}${route}`;
20-
newRoutes[routeWithPrependedLocale] = {
21-
dataRoute: getDataRouteForRoute(route, locale),
22-
srcRoute: route,
23-
...params,
24-
};
25-
});
17+
const locale = route.split("/")[1];
18+
const routeWithoutLocale = `/${route
19+
.split("/")
20+
.slice(2, route.split("/").length)
21+
.join("/")}`;
22+
newRoutes[route] = {
23+
dataRoute: getDataRouteForRoute(routeWithoutLocale, locale),
24+
srcRoute: routeWithoutLocale,
25+
...params,
26+
};
2627
}
2728
}
2829
);

0 commit comments

Comments
 (0)