This repository was archived by the owner on May 10, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -40,13 +40,22 @@ const setup = ({ functionsPath, publishPath }) => {
40
40
const htmlPath = getFilePathForRoute ( route_ , "html" , locale ) ;
41
41
setupStaticFileForPage ( { inputPath : htmlPath , publishPath } ) ;
42
42
43
- const jsonPath = getFilePathForRoute ( route_ , "json" , locale ) ;
44
43
// The provided dataRoutes (from prerender-manifest) for these page types
45
44
// actually don't include the locale (unclear why Vercel did this)
46
45
// BUT the actual path to the .json files DO include the locale
47
46
// therefore we need to set up the .json pages in the locale loop and
48
47
// ignore the dataRoute provided by the prerender-manifest
49
- const i18nDataRoute = getDataRouteForRoute ( route , locale ) ;
48
+ // Also root-level pages are generated into dist at path -> /en/index.json
49
+ // but fetched on the client as /_next/data/{BUILD_ID}/en.json haha love that for me
50
+ const jsonPath =
51
+ route === "/"
52
+ ? getFilePathForRoute ( `/${ locale } ` , "json" )
53
+ : getFilePathForRoute ( route_ , "json" , locale ) ;
54
+ const i18nDataRoute =
55
+ route === "/"
56
+ ? getDataRouteForRoute ( `/${ locale } ` )
57
+ : getDataRouteForRoute ( route , locale ) ;
58
+ const hack2 = getDataRouteForRoute ( `/${ locale } ` ) ;
50
59
setupStaticFileForPage ( {
51
60
inputPath : jsonPath ,
52
61
outputPath : i18nDataRoute ,
You can’t perform that action at this time.
0 commit comments